Mercurial > hg
comparison rust/rhg/src/main.rs @ 49931:fba29deebfe7
rust-clippy: fix remaining warnings in `rhg`
All of these are simple changes that for the most part are clear improvements
and the rest are at most equivalent.
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Mon, 09 Jan 2023 19:32:35 +0100 |
parents | 58074252db3c |
children | 14b57943ae6d |
comparison
equal
deleted
inserted
replaced
49930:e98fd81bb151 | 49931:fba29deebfe7 |
---|---|
282 } | 282 } |
283 _ => non_repo_config_val, | 283 _ => non_repo_config_val, |
284 } | 284 } |
285 } | 285 } |
286 }; | 286 }; |
287 config_val.or(Some(get_path_from_bytes(&repo_arg).to_path_buf())) | 287 config_val |
288 .or_else(|| Some(get_path_from_bytes(&repo_arg).to_path_buf())) | |
288 } | 289 } |
289 }; | 290 }; |
290 | 291 |
291 let simple_exit = | 292 let simple_exit = |
292 |ui: &Ui, config: &Config, result: Result<(), CommandError>| -> ! { | 293 |ui: &Ui, config: &Config, result: Result<(), CommandError>| -> ! { |
422 } | 423 } |
423 Some(executable) => executable, | 424 Some(executable) => executable, |
424 }; | 425 }; |
425 let executable_path = get_path_from_bytes(executable); | 426 let executable_path = get_path_from_bytes(executable); |
426 let this_executable = args.next().expect("exepcted argv[0] to exist"); | 427 let this_executable = args.next().expect("exepcted argv[0] to exist"); |
427 if executable_path == &PathBuf::from(this_executable) { | 428 if executable_path == *this_executable { |
428 // Avoid spawning infinitely many processes until resource | 429 // Avoid spawning infinitely many processes until resource |
429 // exhaustion. | 430 // exhaustion. |
430 let _ = ui.write_stderr(&format_bytes!( | 431 let _ = ui.write_stderr(&format_bytes!( |
431 b"Blocking recursive fallback. The 'rhg.fallback-executable = {}' config \ | 432 b"Blocking recursive fallback. The 'rhg.fallback-executable = {}' config \ |
432 points to `rhg` itself.\n", | 433 points to `rhg` itself.\n", |
737 }) | 738 }) |
738 } | 739 } |
739 } | 740 } |
740 | 741 |
741 /// Array of tuples of (auto upgrade conf, feature conf, local requirement) | 742 /// Array of tuples of (auto upgrade conf, feature conf, local requirement) |
743 #[allow(clippy::type_complexity)] | |
742 const AUTO_UPGRADES: &[((&str, &str), (&str, &str), &str)] = &[ | 744 const AUTO_UPGRADES: &[((&str, &str), (&str, &str), &str)] = &[ |
743 ( | 745 ( |
744 ("format", "use-share-safe.automatic-upgrade-of-mismatching-repositories"), | 746 ("format", "use-share-safe.automatic-upgrade-of-mismatching-repositories"), |
745 ("format", "use-share-safe"), | 747 ("format", "use-share-safe"), |
746 requirements::SHARESAFE_REQUIREMENT, | 748 requirements::SHARESAFE_REQUIREMENT, |