Skip to content

Commit

Permalink
style: another rustfmt run
Browse files Browse the repository at this point in the history
  • Loading branch information
kbknapp committed Oct 1, 2015
1 parent badf735 commit 5227f73
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -15,3 +15,6 @@

# Temporary files
.*~

# Backup files
*.bk
4 changes: 2 additions & 2 deletions src/error.rs
Expand Up @@ -50,8 +50,8 @@ impl Error for CliError {
match *self {
CliError::Semver(_, ref s) => &*s,
CliError::Generic(ref d) => &*d,
CliError::Unknown => "An unknown fatal error has occurred, please consider filing a \
bug-report!",
CliError::Unknown =>
"An unknown fatal error has occurred, please consider filing a bug-report!",
}
}

Expand Down
29 changes: 21 additions & 8 deletions src/main.rs
Expand Up @@ -109,11 +109,13 @@ pub fn from_matches(matches: &ArgMatches) -> CliResult<Clog> {
let mut clog = if let Some(cfg) = matches.value_of("config") {
debugln!("User passed in config file: {:?}", cfg);
if matches.is_present("workdir") && matches.is_present("gitdir") {
debugln!("User passed in both\n\tworking dir: {:?}\n\tgit dir: {:?}", matches.value_of("workdir"), matches.value_of("gitdir"));
debugln!("User passed in both\n\tworking dir: {:?}\n\tgit dir: {:?}",
matches.value_of("workdir"),
matches.value_of("gitdir"));
// use --config --work-tree --git-dir
try!(Clog::with_all(matches.value_of("gitdir").unwrap(),
matches.value_of("workdir").unwrap(),
cfg))
matches.value_of("workdir").unwrap(),
cfg))
} else if let Some(dir) = matches.value_of("workdir") {
debugln!("User passed in working dir: {:?}", dir);
// use --config --work-tree
Expand All @@ -132,7 +134,9 @@ pub fn from_matches(matches: &ArgMatches) -> CliResult<Clog> {
if matches.is_present("gitdir") && matches.is_present("workdir") {
let wdir = matches.value_of("workdir").unwrap();
let gdir = matches.value_of("gitdir").unwrap();
debugln!("User passed in both\n\tworking dir: {:?}\n\tgit dir: {:?}", wdir, gdir);
debugln!("User passed in both\n\tworking dir: {:?}\n\tgit dir: {:?}",
wdir,
gdir);
try!(Clog::with_dirs(gdir, wdir))
} else if let Some(dir) = matches.value_of("gitdir") {
debugln!("User passed in git dir: {:?}", dir);
Expand Down Expand Up @@ -183,10 +187,19 @@ pub fn from_matches(matches: &ArgMatches) -> CliResult<Clog> {
}
_ => unreachable!(),
}
format!("{}{}", if had_v{"v"}else{""}, v)
format!("{}{}",
if had_v {
"v"
} else {
""
},
v)
}
Err(e) => {
return Err(CliError::Semver(Box::new(e), String::from("Failed to parse version into valid SemVer. Ensure the version is in the X.Y.Z format.")));
return Err(CliError::Semver(Box::new(e),
String::from("Failed to parse version into \
valid SemVer. Ensure the version \
is in the X.Y.Z format.")));
}
}
} else {
Expand All @@ -205,8 +218,8 @@ pub fn from_matches(matches: &ArgMatches) -> CliResult<Clog> {
}

if matches.is_present("link-style") {
clog.link_style =
value_t!(matches.value_of("link-style"), LinkStyle).unwrap_or(LinkStyle::Github);
clog.link_style = value_t!(matches.value_of("link-style"), LinkStyle)
.unwrap_or(LinkStyle::Github);
}

if let Some(subtitle) = matches.value_of("subtitle") {
Expand Down

0 comments on commit 5227f73

Please sign in to comment.