Minor fix, add unused_must_use as deny linter
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
db88d31394
commit
a6f4b1d5c5
|
@ -200,10 +200,8 @@ impl Battle {
|
|||
for (side_index, side) in self.sides.iter().enumerate() {
|
||||
// If any side has fled, the battle end.
|
||||
if side.has_fled_battle() {
|
||||
let _w = self.result.write();
|
||||
unsafe {
|
||||
self.result.data_ptr().replace(BattleResult::Inconclusive);
|
||||
}
|
||||
let mut w = self.result.write();
|
||||
*w = BattleResult::Inconclusive;
|
||||
self.has_ended.store(true, Ordering::SeqCst);
|
||||
return Ok(());
|
||||
}
|
||||
|
@ -219,19 +217,13 @@ impl Battle {
|
|||
}
|
||||
// Everyone died :(
|
||||
if !surviving_side_exists {
|
||||
let _w = self.result.write();
|
||||
unsafe {
|
||||
self.result.data_ptr().replace(BattleResult::Inconclusive);
|
||||
}
|
||||
let mut w = self.result.write();
|
||||
*w = BattleResult::Inconclusive;
|
||||
}
|
||||
// Someone survived, they won!
|
||||
else {
|
||||
let _w = self.result.write();
|
||||
unsafe {
|
||||
self.result.data_ptr().replace(BattleResult::Conclusive(
|
||||
winning_side.ok_or(anyhow!("Winning side was not set"))?,
|
||||
));
|
||||
}
|
||||
let mut w = self.result.write();
|
||||
*w = BattleResult::Conclusive(winning_side.ok_or(anyhow!("Winning side was not set"))?);
|
||||
}
|
||||
self.has_ended.store(true, Ordering::SeqCst);
|
||||
Ok(())
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#![deny(clippy::string_slice)]
|
||||
#![deny(clippy::exit)]
|
||||
#![deny(clippy::panic)]
|
||||
#![deny(unused_must_use)]
|
||||
// Features
|
||||
#![feature(test)]
|
||||
#![feature(const_option)]
|
||||
|
|
Loading…
Reference in New Issue