diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-20 01:16:50 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-20 02:22:41 +0900 |
| commit | efec43b3b8827820cf35fe1b73d8e33f5fe84eb4 (patch) | |
| tree | a62bbba72324de48be5f8e689559f8d9e288fc61 /crates/shirabe/src/command/remove_command.rs | |
| parent | cac18ef73a39b4ac41fa4d6ccb753804d4c42cb7 (diff) | |
| download | php-shirabe-efec43b3b8827820cf35fe1b73d8e33f5fe84eb4.tar.gz php-shirabe-efec43b3b8827820cf35fe1b73d8e33f5fe84eb4.tar.zst php-shirabe-efec43b3b8827820cf35fe1b73d8e33f5fe84eb4.zip | |
refactor: auto-fix clippy warnings
Diffstat (limited to 'crates/shirabe/src/command/remove_command.rs')
| -rw-r--r-- | crates/shirabe/src/command/remove_command.rs | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/crates/shirabe/src/command/remove_command.rs b/crates/shirabe/src/command/remove_command.rs index 4e4f5dc..c1ba536 100644 --- a/crates/shirabe/src/command/remove_command.rs +++ b/crates/shirabe/src/command/remove_command.rs @@ -39,6 +39,12 @@ pub struct RemoveCommand { base_command_data: BaseCommandData, } +impl Default for RemoveCommand { + fn default() -> Self { + Self::new() + } +} + impl RemoveCommand { pub fn new() -> Self { let mut command = RemoveCommand { @@ -208,7 +214,7 @@ impl Command for RemoveCommand { .as_list() .map(|l| { l.iter() - .filter_map(|v| v.as_string().map(|s| strtolower(s))) + .filter_map(|v| v.as_string().map(strtolower)) .collect() }) .unwrap_or_default(); @@ -375,22 +381,22 @@ impl Command for RemoveCommand { "<warning>{} could not be found in {} but it is present in {}</warning>", canonical_name, r#type, alt_type )); - if io.is_interactive() { - if io.ask_confirmation( + if io.is_interactive() + && io.ask_confirmation( format!( "Do you want to remove it from {} [<comment>yes</comment>]? ", alt_type ), true, - ) { - if dry_run { - to_remove - .entry(alt_type.to_string()) - .or_default() - .push(canonical_name.clone()); - } else { - json.remove_link(alt_type, &canonical_name); - } + ) + { + if dry_run { + to_remove + .entry(alt_type.to_string()) + .or_default() + .push(canonical_name.clone()); + } else { + json.remove_link(alt_type, &canonical_name); } } } else { @@ -436,22 +442,22 @@ impl Command for RemoveCommand { "<warning>{} could not be found in {} but it is present in {}</warning>", matched_package, r#type, alt_type )); - if io.is_interactive() { - if io.ask_confirmation( + if io.is_interactive() + && io.ask_confirmation( format!( "Do you want to remove it from {} [<comment>yes</comment>]? ", alt_type ), true, - ) { - if dry_run { - to_remove - .entry(alt_type.to_string()) - .or_default() - .push(matched_package.clone()); - } else { - json.remove_link(alt_type, matched_package); - } + ) + { + if dry_run { + to_remove + .entry(alt_type.to_string()) + .or_default() + .push(matched_package.clone()); + } else { + json.remove_link(alt_type, matched_package); } } } @@ -675,7 +681,7 @@ impl Command for RemoveCommand { .set_platform_requirement_filter(self.get_platform_requirement_filter(input.clone())?); install.set_dry_run(dry_run); install.set_audit_config( - self.create_audit_config(&mut *composer.get_config().borrow_mut(), input)?, + self.create_audit_config(&mut composer.get_config().borrow_mut(), input)?, ); install.set_minimal_update(minimal_changes); |
