Skip to content

Commit

Permalink
Fix more clippy warning - without autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvestre committed Oct 18, 2023
1 parent eb929d1 commit b8d8f57
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
14 changes: 9 additions & 5 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,10 @@ impl DistClientContainer {
| DistClientState::FailWithMessage(cfg, _)
| DistClientState::RetryCreateAt(cfg, _) => {
warn!("State reset. Will recreate");
*state =
DistClientState::RetryCreateAt(cfg, Instant::now() - Duration::from_secs(1));
*state = DistClientState::RetryCreateAt(
cfg,
Instant::now().checked_sub(Duration::from_secs(1)).unwrap(),
);
}
DistClientState::Disabled => (),
}
Expand Down Expand Up @@ -277,8 +279,10 @@ impl DistClientContainer {
};
// The client is most likely mis-configured, make sure we
// re-create on our next attempt.
*state =
DistClientState::RetryCreateAt(config, Instant::now() - Duration::from_secs(1));
*state = DistClientState::RetryCreateAt(
config,
Instant::now().checked_sub(Duration::from_secs(1)).unwrap(),
);
}
res
}
Expand Down Expand Up @@ -587,7 +591,7 @@ impl<C: CommandCreatorSync> SccacheServer<C> {

// We're not interested if the task panicked; immediately process
// another connection
let _ = tokio::spawn(conn);
let _ = tokio::spawn(conn).await;
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/test/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ fn test_server_port_in_use() {
// Bind an arbitrary free port.
let listener = TcpListener::bind("127.0.0.1:0").unwrap();
let sccache = find_sccache_binary();
let output = Command::new(&sccache)
let output = Command::new(sccache)
.arg("--start-server")
.env(
"SCCACHE_SERVER_PORT",
Expand Down
1 change: 1 addition & 0 deletions src/test/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ pub fn mk_bin_contents<F: FnOnce(File) -> io::Result<()>>(
let bin = dir.join(path);
let parent = bin.parent().unwrap();
fs::create_dir_all(parent)?;
#[allow(clippy::unnecessary_cast)]
let f = fs::OpenOptions::new()
.write(true)
.create(true)
Expand Down

0 comments on commit b8d8f57

Please sign in to comment.