Skip to content

Commit 5c75743

Browse files
authored
Merge pull request #146 from neosilky/clippy-fixes
Fix some style issues given by clippy
2 parents 4d77d17 + 436abb5 commit 5c75743

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/lib.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ impl Config {
685685

686686
for &(ref key, ref value) in self.definitions.iter() {
687687
let lead = if let ToolFamily::Msvc = cmd.family {"/"} else {"-"};
688-
if let &Some(ref value) = value {
688+
if let Some(ref value) = *value {
689689
cmd.args.push(format!("{}D{}={}", lead, key, value).into());
690690
} else {
691691
cmd.args.push(format!("{}D{}", lead, key).into());
@@ -706,7 +706,7 @@ impl Config {
706706
cmd.arg("/I").arg(directory);
707707
}
708708
for &(ref key, ref value) in self.definitions.iter() {
709-
if let &Some(ref value) = value {
709+
if let Some(ref value) = *value {
710710
cmd.arg(&format!("/D{}={}", key, value));
711711
} else {
712712
cmd.arg(&format!("/D{}", key));
@@ -732,7 +732,7 @@ impl Config {
732732
if target.contains("msvc") {
733733
let mut cmd = match self.archiver {
734734
Some(ref s) => self.cmd(s),
735-
None => windows_registry::find(&target, "lib.exe").unwrap_or(self.cmd("lib.exe")),
735+
None => windows_registry::find(&target, "lib.exe").unwrap_or_else(|| self.cmd("lib.exe")),
736736
};
737737
let mut out = OsString::from("/OUT:");
738738
out.push(dst);
@@ -752,7 +752,6 @@ impl Config {
752752
// if hard-link fails, just copy (ignoring the number of bytes written)
753753
fs::copy(&dst, &lib_dst).map(|_| ())
754754
})
755-
.ok()
756755
.expect("Copying from {:?} to {:?} failed.");;
757756
} else {
758757
let ar = self.get_ar();
@@ -818,7 +817,7 @@ impl Config {
818817
for &(ref a, ref b) in self.env.iter() {
819818
cmd.env(a, b);
820819
}
821-
return cmd;
820+
cmd
822821
}
823822

824823
fn get_base_compiler(&self) -> Tool {
@@ -848,7 +847,7 @@ impl Config {
848847
for arg in args {
849848
t.args.push(arg.into());
850849
}
851-
return t;
850+
t
852851
})
853852
.or_else(|| {
854853
if target.contains("emscripten") {
@@ -950,7 +949,7 @@ impl Config {
950949
self.get_var(name).ok().map(|tool| {
951950
let whitelist = ["ccache", "distcc"];
952951
for t in whitelist.iter() {
953-
if tool.starts_with(t) && tool[t.len()..].starts_with(" ") {
952+
if tool.starts_with(t) && tool[t.len()..].starts_with(' ') {
954953
return (t.to_string(), vec![tool[t.len()..].trim_left().to_string()]);
955954
}
956955
}
@@ -1110,7 +1109,7 @@ fn run_output(cmd: &mut Command, program: &str) -> Vec<u8> {
11101109
if !status.success() {
11111110
fail(&format!("command did not execute successfully, got: {}", status));
11121111
}
1113-
return stdout
1112+
stdout
11141113
}
11151114

11161115
fn spawn(cmd: &mut Command, program: &str) -> (Child, JoinHandle<()>) {

0 commit comments

Comments
 (0)