diff --git a/Cargo.toml b/Cargo.toml index 5765c7a..a0b7eac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,6 +30,16 @@ codegen-units = 256 incremental = true panic = "abort" +# [profile.dev-analysis] +# inherits = "dev" +# opt-level = 0 +# debug = 0 +# strip = "none" +# lto = false +# # codegen-units = 256 +# incremental = true +# # codegen-backend = "cranelift" + [workspace.dependencies] config = {path = "./crates/config"} tablegen = {path = "./crates/tablegen"} diff --git a/crates/graphs/src/graphs.rs b/crates/graphs/src/graphs.rs index 4c17e52..71ee4f8 100644 --- a/crates/graphs/src/graphs.rs +++ b/crates/graphs/src/graphs.rs @@ -48,7 +48,7 @@ fn init_graph_config(_args: &GraphConfig) -> Result<()> { /// Load the config if given of the default config if none fn load_graph_config(args: &GraphConfig) -> Result { if let Some(c) = &args.config { - println!("[INFO] Reading config {}", &c); + println!("[INFO] Reading config {}", c); let mut f = File::open(c).context("Opening config")?; let mut buf = String::new(); f.read_to_string(&mut buf).context("Reading the config")?; @@ -104,8 +104,8 @@ fn gen_graph(args: &GraphConfig) -> Result<()> { let cfg = load_graph_config(args)?; for graph in csv.values { - let path_svg = format!("{}/{}.svg", args.destination, &graph.name); - let path_png = format!("{}/{}.png", args.destination, &graph.name); + let path_svg = format!("{}/{}.svg", args.destination, graph.name); + let path_png = format!("{}/{}.png", args.destination, graph.name); println!("[INFO] Processing {}", path_svg); let mut f = File::create(&path_svg)?; diff --git a/crates/make/src/makepdf_functions.rs b/crates/make/src/makepdf_functions.rs index 60a6b88..656cebb 100644 --- a/crates/make/src/makepdf_functions.rs +++ b/crates/make/src/makepdf_functions.rs @@ -89,7 +89,7 @@ pub(super) fn make_file(args: &MakeConfig) -> BuilderParseResult { } BuilderParseResult { - new_name: format!("{:?}", &path), + new_name: format!("{:?}", path), chapt_list: chapters, } } @@ -301,9 +301,9 @@ pub(super) fn make_clean(args: &MakeConfig) { for s in list_suff { // The most ghetto *** I've done so far // cmd.arg(format!("{}{}", &target, s)); - cmd.arg(format!("{}_build{}", &target, s)); + cmd.arg(format!("{}_build{}", target, s)); } - cmd.arg(format!("{}_build{}", &target, ".tex")); + cmd.arg(format!("{}_build{}", target, ".tex")); // println!("{:?}", cmd); if let Err(e) = cmd.output() { println!( diff --git a/crates/monsters/src/lib.rs b/crates/monsters/src/lib.rs index d598fb2..c992535 100644 --- a/crates/monsters/src/lib.rs +++ b/crates/monsters/src/lib.rs @@ -43,7 +43,7 @@ pub fn monsters_dispatch(args: &MonsterConfig, config: &Config) -> Result<()> { // MonsterTarget::Show => unimplemented!("implement show logic"), MonsterTarget::Balance(ref args) => { let connection = Connection::open(&args.db.database) - .context(format!("Opening database {}", &args.db.database))?; + .context(format!("Opening database {}", args.db.database))?; show_balancing_data(args, config, connection)? } } diff --git a/crates/monsters/src/monster_analysis/monster_analysis_structs.rs b/crates/monsters/src/monster_analysis/monster_analysis_structs.rs index 37b16ff..4bff56a 100644 --- a/crates/monsters/src/monster_analysis/monster_analysis_structs.rs +++ b/crates/monsters/src/monster_analysis/monster_analysis_structs.rs @@ -219,8 +219,8 @@ impl DamageCategory { pub fn from_percent(percent: f64) -> Self { match percent { ..0.01 => Self::None, - 0.01..0.15 => Self::Chip, - 0.15..0.5 => Self::Moderate, + 0.01..0.25 => Self::Chip, + 0.25..0.5 => Self::Moderate, 0.5..0.8 => Self::High, 0.8..1.0 => Self::NearDeath, 1.0..1.5 => Self::Kill, diff --git a/crates/monsters/src/monster_export.rs b/crates/monsters/src/monster_export.rs index 3cd94b2..c4e2d70 100644 --- a/crates/monsters/src/monster_export.rs +++ b/crates/monsters/src/monster_export.rs @@ -64,14 +64,14 @@ pub fn generate_monsters_tex( if args.player || args.all { println!("Generating Player Bestiaire"); let path = format!("./{}/player_bestiaire.tex", args.destination); - let mut f = File::create(&path).context(format!("Opening file {}", &path))?; - write!(f, "{}", p_out).context(format!("Writing {}", &path))?; + let mut f = File::create(&path).context(format!("Opening file {}", path))?; + write!(f, "{}", p_out).context(format!("Writing {}", path))?; } if args.master || args.all { println!("Generating Master Bestiaire"); let path = format!("./{}/master_bestiaire.tex", args.destination); - let mut f = File::create(&path).context(format!("Opening file {}", &path))?; - write!(f, "{}", m_out).context(format!("Writing {}", &path))?; + let mut f = File::create(&path).context(format!("Opening file {}", path))?; + write!(f, "{}", m_out).context(format!("Writing {}", path))?; } Ok(()) } diff --git a/crates/tablegen/src/table_types.rs b/crates/tablegen/src/table_types.rs index 14575de..4a4044b 100644 --- a/crates/tablegen/src/table_types.rs +++ b/crates/tablegen/src/table_types.rs @@ -137,7 +137,7 @@ impl WriteTable for ClassesArray { continue; } if lvl != 0 { - writeln!(buffer, "{}", &config.classes.sep)?; + writeln!(buffer, "{}", config.classes.sep)?; } writeln!(buffer, "{}", formatted_tier)?; for elem in tier { diff --git a/crates/weaponry/Cargo.toml b/crates/weaponry/Cargo.toml index 3e19fa3..abafc47 100644 --- a/crates/weaponry/Cargo.toml +++ b/crates/weaponry/Cargo.toml @@ -34,5 +34,8 @@ rayon = "1.12.0" name = "iter_creation" harness = false +[features] +dev-analysis = [] # gate for the feature flag + # [lints.rust] # unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin_include)'] } diff --git a/crates/weaponry/src/database.rs b/crates/weaponry/src/database.rs index 5f5c048..e3cbc8d 100644 --- a/crates/weaponry/src/database.rs +++ b/crates/weaponry/src/database.rs @@ -30,7 +30,7 @@ where /// Generate a SELECT query with fields generated from a struct. Returns a SQL request as a String #[inline] -#[coverage(off)] // INCORRECT: Error with line report +#[cfg_attr(feature = "dev-analysis", coverage(off))] // INCORRECT: Error with line report fn generate_select_query( table_name: &str, filter: Option<&str>, diff --git a/crates/weaponry/src/interfaces.rs b/crates/weaponry/src/interfaces.rs index c838794..775a5d7 100644 --- a/crates/weaponry/src/interfaces.rs +++ b/crates/weaponry/src/interfaces.rs @@ -62,7 +62,7 @@ where /// A blanket implementation giving all combinaisons of recipes with another RecipeCollection /// /// This method doesn't make use of parallel iterators as the workload is way faster than would be the memory dispatch - #[coverage(off)] // Tarpaulin cannot deal with iter and long lines + #[cfg_attr(feature = "dev-analysis", coverage(off))] // Tarpaulin cannot deal with iter and long lines fn combine_all(&mut self, other: &G) where G: RecipeCollection, @@ -96,7 +96,7 @@ where fn from_vectored(list: Vec) -> Self; /// Create a collection from an iterator of intermediate values T - #[coverage(off)] // INCORRECT: Error with line report + #[cfg_attr(feature = "dev-analysis", coverage(off))] // INCORRECT: Error with line report fn from_iter_intermediate( iter_inter: impl Iterator>, ) -> Result @@ -233,7 +233,7 @@ pub trait RecipeDatabase { } /// Insert a row inside the database, while mostly unused this function is needed to initialize the empty table with an empty row if needed - #[coverage(off)] // INCORRECT: Error with line report + #[cfg_attr(feature = "dev-analysis", coverage(off))] // INCORRECT: Error with line report fn insert_row( &self, table_name: &str, diff --git a/crates/weaponry/src/lib.rs b/crates/weaponry/src/lib.rs index 0942313..3b72a7a 100644 --- a/crates/weaponry/src/lib.rs +++ b/crates/weaponry/src/lib.rs @@ -2,10 +2,9 @@ // File: weaponry/src/lib.rs //! Weaponry module, handling all weaponry creation and analysis -#![feature(coverage_attribute)] -// #![feature(int_roundings)] +#![cfg_attr(feature = "dev-analysis", feature(coverage_attribute))] #![warn(missing_docs, clippy::missing_docs_in_private_items)] -#![feature(iter_intersperse)] +// #![feature(iter_intersperse)] pub mod analysis; mod database; diff --git a/crates/weaponry/src/weaponry_structs/equipement_impl_basics.rs b/crates/weaponry/src/weaponry_structs/equipement_impl_basics.rs index 9daaa7f..962e367 100644 --- a/crates/weaponry/src/weaponry_structs/equipement_impl_basics.rs +++ b/crates/weaponry/src/weaponry_structs/equipement_impl_basics.rs @@ -136,7 +136,7 @@ impl Display for InnerEquipementStats { vec![ self.special .iter() - .intersperse(&",".to_string()) + // .intersperse(&",".to_string()) .fold(String::new(), |res, new| format!("{}; {}", res, new)), ], ); @@ -190,7 +190,7 @@ impl Default for FilterFunction { } } impl PartialEq for FilterFunction { - // #[coverage(off)] // INCORRECT: Error with line report + #[cfg_attr(feature = "dev-analysis", coverage(off))] // INCORRECT: Error with line report fn eq(&self, _other: &Self) -> bool { true } diff --git a/crates/weaponry/src/weaponry_structs/equipement_impl_database.rs b/crates/weaponry/src/weaponry_structs/equipement_impl_database.rs index c9fdb5e..0031d1f 100644 --- a/crates/weaponry/src/weaponry_structs/equipement_impl_database.rs +++ b/crates/weaponry/src/weaponry_structs/equipement_impl_database.rs @@ -30,7 +30,7 @@ impl RecipeDatabase for EquipementDatabase { &self.conn } - #[coverage(off)] // INCORRECT: Error with line report + #[cfg_attr(feature = "dev-analysis", coverage(off))] // INCORRECT: Error with line report fn serialize_into_intermediate( &self, table: &str, @@ -132,7 +132,7 @@ impl TryFrom for InnerEquipementStats { type SubCategories = (Option, Option); /// Infer all subcategories from a deserialized DatabaseCategory -#[coverage(off)] // A test would literally be a copy paste of this match +#[cfg_attr(feature = "dev-analysis", coverage(off))] // A test would literally be a copy paste of this match fn get_sub_categories_from_serde(category: &str) -> Result { Ok(if let Some(category) = from_serde!(category)? { match category { diff --git a/helper_config.toml b/helper_config.toml index 8df5d8c..35cedb4 100644 --- a/helper_config.toml +++ b/helper_config.toml @@ -229,7 +229,7 @@ master_part = ''' \SetCell{c} Res & \slash & \pierce & \blunt & \symceleste & \symfire & \symearth & \symwood & \symmagma & \symabyss & \symwater & \symwind & \symice & \symthunder \\ \hline {{#each body_parts.body_parts}} -\SetCell{font=\footnotesize} {{{body_part_name}}} & ${{{slash}}} $ & ${{{pierce}}} $ & ${{{blunt}}} $ & ${{{celestial}}} $ & ${{{fire}}} $ & ${{{earth}}} $ & ${{{wood}}} $ & ${{{magma}}} $ & ${{{celeste}}} $ & ${{{water}}} $ & ${{{wind}}} $ & ${{{ice}}} $ & ${{{thunder}}} $ \\ +\SetCell{font=\footnotesize} {{{body_part_name}}} & ${{{slash}}} $ & ${{{piercing}}} $ & ${{{blunt}}} $ & ${{{celestial}}} $ & ${{{fire}}} $ & ${{{earth}}} $ & ${{{wood}}} $ & ${{{magma}}} $ & ${{{celeste}}} $ & ${{{water}}} $ & ${{{wind}}} $ & ${{{ice}}} $ & ${{{thunder}}} $ \\ {{/each}} \end{tblr} \end{center} diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 5d56faf..292fe49 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "nightly" +channel = "stable"