Skip to content

Commit 30c6b72

Browse files
author
InventiveCoder
authored
refactor: Optimize code based on cargo clippy suggestions (#1013)
Signed-off-by: InventiveCoder <[email protected]>
1 parent f36d6a7 commit 30c6b72

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

src/lib.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -2060,14 +2060,11 @@ impl Build {
20602060
} else {
20612061
cmd.push_cc_arg(format!("--target={}", target).into());
20622062
}
2063-
} else {
2064-
if target.contains("i586") {
2065-
cmd.push_cc_arg("-arch:IA32".into());
2066-
} else if target.contains("arm64ec") {
2067-
cmd.push_cc_arg("-arm64EC".into());
2068-
}
2063+
} else if target.contains("i586") {
2064+
cmd.push_cc_arg("-arch:IA32".into());
2065+
} else if target.contains("arm64ec") {
2066+
cmd.push_cc_arg("-arm64EC".into());
20692067
}
2070-
20712068
// There is a check in corecrt.h that will generate a
20722069
// compilation error if
20732070
// _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE is
@@ -3414,12 +3411,11 @@ impl Build {
34143411
})
34153412
})
34163413
.map(|prefix| *prefix)
3417-
.or_else(||
34183414
// If no toolchain was found, provide the first toolchain that was passed in.
34193415
// This toolchain has been shown not to exist, however it will appear in the
34203416
// error that is shown to the user which should make it easier to search for
34213417
// where it should be obtained.
3422-
prefixes.first().map(|prefix| *prefix))
3418+
.or_else(|| prefixes.first().map(|prefix| *prefix))
34233419
}
34243420

34253421
fn get_target(&self) -> Result<Arc<str>, Error> {
@@ -3753,6 +3749,7 @@ enum AppleOs {
37533749
WatchOs,
37543750
TvOs,
37553751
}
3752+
37563753
impl std::fmt::Debug for AppleOs {
37573754
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
37583755
match self {

src/tool.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,8 @@ impl Tool {
233233
if chars.next() != Some('/') {
234234
return false;
235235
}
236-
} else if self.is_like_gnu() || self.is_like_clang() {
237-
if chars.next() != Some('-') {
238-
return false;
239-
}
236+
} else if (self.is_like_gnu() || self.is_like_clang()) && chars.next() != Some('-') {
237+
return false;
240238
}
241239

242240
// Check for existing optimization flags (-O, /O)

0 commit comments

Comments
 (0)