about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorCaleb Cartwright <caleb.cartwright@outlook.com>2021-09-16 21:25:09 -0500
committerCaleb Cartwright <calebcartwright@users.noreply.github.com>2021-09-16 22:01:50 -0500
commit7aa69e5bc87f32fdcbf037abce2d575335480b9a (patch)
tree579be57cd93f50a77125b5bc31891316f53d5eee /src
parent17cb2b147e11c9ad274b316026b1001fbd7007d4 (diff)
downloadrust-7aa69e5bc87f32fdcbf037abce2d575335480b9a.tar.gz
rust-7aa69e5bc87f32fdcbf037abce2d575335480b9a.zip
refactor: use iter workaround for contains() gap
Diffstat (limited to 'src')
-rw-r--r--src/cargo-fmt/main.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cargo-fmt/main.rs b/src/cargo-fmt/main.rs
index 89ce454ac4d..147b19d7a48 100644
--- a/src/cargo-fmt/main.rs
+++ b/src/cargo-fmt/main.rs
@@ -109,9 +109,9 @@ fn execute() -> i32 {
     let strategy = CargoFmtStrategy::from_opts(&opts);
     let mut rustfmt_args = opts.rustfmt_options;
     if opts.check {
-        let check_flag = String::from("--check");
-        if !rustfmt_args.contains(&check_flag) {
-            rustfmt_args.push(check_flag);
+        let check_flag = "--check";
+        if !rustfmt_args.iter().any(|o| o == check_flag) {
+            rustfmt_args.push(check_flag.to_owned());
         }
     }
     if let Some(message_format) = opts.message_format {