refactor: use iter workaround for contains() gap

This commit is contained in:
Caleb Cartwright 2021-09-16 21:25:09 -05:00 committed by Caleb Cartwright
parent 17cb2b147e
commit 7aa69e5bc8

View file

@ -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 {