Skip to content

Commit

Permalink
Clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
schaefi committed Mar 27, 2024
1 parent 3edb4fe commit 536a5d0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion flake-ctl/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ pub fn remove(app: &str, engine: &str, silent: bool) -> bool {
}
}
}
return true
true
}

pub fn basename(program_path: &String) -> String {
Expand Down
2 changes: 2 additions & 0 deletions flake-ctl/src/app_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ impl AppConfig {
let config = std::fs::OpenOptions::new()
.write(true)
.create(true)
.truncate(true)
.open(config_file)
.unwrap_or_else(|_| panic!("Failed to open {:?}", config_file));
serde_yaml::to_writer(config, &yaml_config).unwrap();
Expand Down Expand Up @@ -304,6 +305,7 @@ impl AppConfig {
let config = std::fs::OpenOptions::new()
.write(true)
.create(true)
.truncate(true)
.open(config_file)
.unwrap_or_else(|_| panic!("Failed to open {:?}", config_file));
serde_yaml::to_writer(config, &yaml_config).unwrap();
Expand Down
24 changes: 10 additions & 14 deletions flake-ctl/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,11 @@ async fn main() -> Result<ExitCode, Box<dyn std::error::Error>> {
},
// remove
cli::Firecracker::Remove { vm, app } => {
if ! app.is_none() {
if ! app::remove(
app.as_ref().map(String::as_str).unwrap(),
defaults::FIRECRACKER_PILOT, false
) {
return Ok(ExitCode::FAILURE)
}
if ! app.is_none() && ! app::remove(
app.as_ref().map(String::as_str).unwrap(),
defaults::FIRECRACKER_PILOT, false
) {
return Ok(ExitCode::FAILURE)
}
if ! vm.is_none() {
app::purge(
Expand Down Expand Up @@ -182,13 +180,11 @@ async fn main() -> Result<ExitCode, Box<dyn std::error::Error>> {
},
// remove
cli::Podman::Remove { container, app } => {
if ! app.is_none() {
if ! app::remove(
app.as_ref().map(String::as_str).unwrap(),
defaults::PODMAN_PILOT, false
) {
return Ok(ExitCode::FAILURE)
}
if ! app.is_none() && ! app::remove(
app.as_ref().map(String::as_str).unwrap(),
defaults::PODMAN_PILOT, false
) {
return Ok(ExitCode::FAILURE)
}
if ! container.is_none() {
app::purge(
Expand Down

0 comments on commit 536a5d0

Please sign in to comment.