karma: leaderboard + rank, drop code-noise targets, atomic store writes
All checks were successful
ci / check (push) Successful in 48s
All checks were successful
ci / check (push) Successful in 48s
This commit is contained in:
parent
21e36b9961
commit
af9d5eed25
5 changed files with 159 additions and 16 deletions
|
|
@ -132,7 +132,12 @@ impl Store {
|
|||
}
|
||||
|
||||
fn save(&self, path: &Path) -> io::Result<()> {
|
||||
fs::write(path, to_json(&self.map) + "\n")
|
||||
let body = to_json(&self.map) + "\n";
|
||||
let mut tmp = path.to_path_buf().into_os_string();
|
||||
tmp.push(".tmp");
|
||||
let tmp = PathBuf::from(tmp);
|
||||
fs::write(&tmp, body)?;
|
||||
fs::rename(&tmp, path)
|
||||
}
|
||||
|
||||
fn get(&self, nick: &str) -> Option<&String> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue