clean up some warnings

This commit is contained in:
Joachim Lusiardi 2024-01-14 13:31:40 +01:00
parent 5265682c53
commit 119a3d314a
4 changed files with 7 additions and 10 deletions

View File

@ -1,5 +1,6 @@
use rand::Rng;
pub fn do_challenge(stat: u8) -> (bool, u8) {
if stat <= 20 {
let mut rng = rand::thread_rng();
@ -19,6 +20,7 @@ pub fn do_challenge(stat: u8) -> (bool, u8) {
(false, 0)
}
#[allow(dead_code)]
pub struct PlayerStats {
// dungeon slayer attributes
pub(crate) body: u8,
@ -93,6 +95,7 @@ impl PlayerStats {
}
}
#[allow(dead_code)]
pub struct MonsterStats {
// dungeon slayer attributes
pub(crate) body: u8,

View File

@ -1,8 +1,5 @@
use std::cmp::{max, min};
use rand::Rng;
use rand::rngs::ThreadRng;
#[cfg(test)]
use crate::artifacts::{Chest, Potion};
use crate::artifacts::Artifact;
@ -38,7 +35,6 @@ pub struct Level {
pub(crate) start: (usize, usize),
/// the position of the end in the level (either stair down or end point)
pub(crate) end: (usize, usize),
pub(crate) rng: ThreadRng,
}
impl Level {
@ -210,7 +206,6 @@ impl Level {
artifacts: Vec::with_capacity(10),
start: (0, 0),
end: (0, 0),
rng: rand::thread_rng(),
}
}
#[cfg(test)]

View File

@ -11,7 +11,7 @@ use rand::rngs::ThreadRng;
use crate::artifacts::{Artifact, Chest, Potion};
use crate::level::{Level, StructureElement};
use crate::monster::{LowerDaemon, Monster, Orc, Rat};
use crate::monster::{LowerDaemon, Monster, Rat};
use crate::position::Position;
const ROOMS_VERTICAL: usize = 7;
@ -344,7 +344,6 @@ impl LevelGenerator {
artifacts,
start: (start_x, start_y),
end: (end_x, end_y),
rng: rand::thread_rng(),
}
}
}

View File

@ -98,7 +98,7 @@ impl crate::monster::LowerDaemon {
}
}
fn calc_move(&self, level: &Level, player_pos: &Position) -> (i16, i16) {
fn calc_move(&self, _level: &Level, player_pos: &Position) -> (i16, i16) {
let d = self.position.distance(player_pos);
if d == 1 {
return self.position.get_direction(player_pos);
@ -160,7 +160,7 @@ impl Rat {
monster_stats,
}
}
fn calc_move(&self, level: &Level, player_pos: &Position) -> (i16, i16) {
fn calc_move(&self, _level: &Level, _player_pos: &Position) -> (i16, i16) {
match rand::thread_rng().gen_range(0..5) {
1 => { (1, 0) }
2 => { (-1, 0) }
@ -218,7 +218,7 @@ impl Orc {
monster_stats,
}
}
fn calc_move(&self, level: &Level, player_pos: &Position) -> (i16, i16) {
fn calc_move(&self, _level: &Level, _player_pos: &Position) -> (i16, i16) {
match rand::thread_rng().gen_range(0..5) {
1 => { (1, 0) }
2 => { (-1, 0) }