postpone clone after found (#1656)
commit7083b98a388b30e0b61caac9bf6ccc1d79eadf81
authorCydiater <cydiater@gmail.com>
dateSun 13 Feb 2022, 12:53 (5 years ago)
parenta19a6ca
helix-term/src/commands.rs+1−1
@@ -445,8 +445,8 @@ impl std::str::FromStr for MappableCommand {
445445 } else {
446446 MappableCommand::STATIC_COMMAND_LIST
447447 .iter()
448− .cloned()
449448 .find(|cmd| cmd.name() == s)
449+ .cloned()
450450 .ok_or_else(|| anyhow!("No command named '{}'", s))
451451 }
452452 }