Skip to content

Commit 4e1c4e6

Browse files
refactor: use find_map-strip_suffix instead of find-map-split for --driver-mode=… search
1 parent bf4dcf7 commit 4e1c4e6

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2755,10 +2755,7 @@ impl Build {
27552755
.map(|(tool, wrapper, args)| {
27562756
// find the driver mode, if any
27572757
const DRIVER_MODE: &str = "--driver-mode=";
2758-
let driver_mode = args
2759-
.iter()
2760-
.find(|a| a.starts_with(DRIVER_MODE))
2761-
.map(|a| &a[DRIVER_MODE.len()..]);
2758+
let driver_mode = args.iter().find_map(|a| a.strip_suffix(DRIVER_MODE));
27622759
// Chop off leading/trailing whitespace to work around
27632760
// semi-buggy build scripts which are shared in
27642761
// makefiles/configure scripts (where spaces are far more

0 commit comments

Comments
 (0)