more linter clean-up

This commit is contained in:
Llywelwyn 2023-09-18 21:54:29 +01:00
parent 27c1fe9a48
commit c4aa3de640
3 changed files with 14 additions and 16 deletions

View file

@ -7,7 +7,6 @@ pub struct ApproachAI {}
impl<'a> System<'a> for ApproachAI { impl<'a> System<'a> for ApproachAI {
#[allow(clippy::type_complexity)] #[allow(clippy::type_complexity)]
type SystemData = ( type SystemData = (
WriteExpect<'a, RandomNumberGenerator>,
WriteStorage<'a, TakingTurn>, WriteStorage<'a, TakingTurn>,
WriteStorage<'a, WantsToApproach>, WriteStorage<'a, WantsToApproach>,
WriteStorage<'a, Position>, WriteStorage<'a, Position>,
@ -20,7 +19,6 @@ impl<'a> System<'a> for ApproachAI {
fn run(&mut self, data: Self::SystemData) { fn run(&mut self, data: Self::SystemData) {
let ( let (
mut rng,
mut turns, mut turns,
mut wants_to_approach, mut wants_to_approach,
mut positions, mut positions,

View file

@ -31,15 +31,15 @@ pub const YOU_REMOVE_ITEM: &str = "You unequip your";
pub const YOU_REMOVE_ITEM_CURSED: &str = "You can't remove the"; pub const YOU_REMOVE_ITEM_CURSED: &str = "You can't remove the";
/// Prefixes death message. /// Prefixes death message.
pub const PlayerDied: &str = "You died!"; pub const PLAYER_DIED: &str = "You died!";
/// Death message specifiers. Appended after PlayerDied. /// Death message specifiers. Appended after PlayerDied.
pub const PlayerDied_SUICIDE: &str = "You killed yourself"; pub const PLAYER_DIED_SUICIDE: &str = "You killed yourself";
pub const PlayerDied_NAMED_ATTACKER: &str = "You were killed by"; pub const PLAYER_DIED_NAMED_ATTACKER: &str = "You were killed by";
pub const PlayerDied_UNKNOWN: &str = "You were killed"; // Ultimately, this should never be used. Slowly include specific messages for any death. pub const PLAYER_DIED_UNKNOWN: &str = "You were killed"; // Ultimately, this should never be used. Slowly include specific messages for any death.
/// Death message addendums. Appended at end of death message. /// Death message addendums. Appended at end of death message.
pub const PlayerDied_ADDENDUM_FIRST: &str = " "; pub const PLAYER_DIED_ADDENDUM_FIRST: &str = " ";
pub const PlayerDied_ADDENDUM_MID: &str = ", "; pub const PLAYER_DIED_ADDENDUM_MID: &str = ", ";
pub const PlayerDied_ADDENDUM_LAST: &str = ", and "; pub const PLAYER_DIED_ADDENDUM_LAST: &str = ", and ";
pub const STATUS_CONFUSED_STRING: &str = "confused"; pub const STATUS_CONFUSED_STRING: &str = "confused";
pub const STATUS_BLIND_STRING: &str = "blinded"; pub const STATUS_BLIND_STRING: &str = "blinded";
// Results in something like: "You died! You were killed by a kobold captain, whilst confused." // Results in something like: "You died! You were killed by a kobold captain, whilst confused."

View file

@ -170,16 +170,16 @@ fn get_next_level_requirement(level: i32) -> i32 {
fn get_death_message(ecs: &World, source: Entity) -> String { fn get_death_message(ecs: &World, source: Entity) -> String {
let player = ecs.fetch::<Entity>(); let player = ecs.fetch::<Entity>();
let mut result: String = format!("{} ", PlayerDied); let mut result: String = format!("{} ", PLAYER_DIED);
// If we killed ourselves, // If we killed ourselves,
if source == *player { if source == *player {
result.push_str(format!("{}", PlayerDied_SUICIDE).as_str()); result.push_str(format!("{}", PLAYER_DIED_SUICIDE).as_str());
} else if let Some(name) = ecs.read_storage::<Name>().get(source) { } else if let Some(name) = ecs.read_storage::<Name>().get(source) {
result.push_str( result.push_str(
format!("{} {}", PlayerDied_NAMED_ATTACKER, with_article(name.name.clone())).as_str() format!("{} {}", PLAYER_DIED_NAMED_ATTACKER, with_article(name.name.clone())).as_str()
); );
} else { } else {
result.push_str(format!("{}", PlayerDied_UNKNOWN).as_str()); result.push_str(format!("{}", PLAYER_DIED_UNKNOWN).as_str());
} }
// Status effects // Status effects
{ {
@ -194,11 +194,11 @@ fn get_death_message(ecs: &World, source: Entity) -> String {
result.push_str(" whilst"); result.push_str(" whilst");
for (i, addendum) in addendums.iter().enumerate() { for (i, addendum) in addendums.iter().enumerate() {
if i == 0 { if i == 0 {
result.push_str(format!("{}{}", PlayerDied_ADDENDUM_FIRST, addendum).as_str()); result.push_str(format!("{}{}", PLAYER_DIED_ADDENDUM_FIRST, addendum).as_str());
} else if i == addendums.len() { } else if i == addendums.len() {
result.push_str(format!("{}{}", PlayerDied_ADDENDUM_LAST, addendum).as_str()); result.push_str(format!("{}{}", PLAYER_DIED_ADDENDUM_LAST, addendum).as_str());
} else { } else {
result.push_str(format!("{}{}", PlayerDied_ADDENDUM_MID, addendum).as_str()); result.push_str(format!("{}{}", PLAYER_DIED_ADDENDUM_MID, addendum).as_str());
} }
} }
} }