From c6d515be44d3b9c3979fc6c6151d31c23221be45 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Thu, 9 Apr 2026 11:44:56 -0400 Subject: [PATCH] fix(lint): clean up fabro-config test clippy warnings - Drop the fabro_types::Combine re-export from fabro-config/lib.rs (unused externally after Stage 3 replaced the legacy Combine-based merge with the v2 merge matrix) - Replace absolute `fabro_types::settings::v2::InterpString` paths in fabro-config/src/config.rs and merge.rs test blocks with a scoped `use` import, satisfying clippy::absolute_paths - fabro-config/src/merge.rs tests: use `!contains_key`, drop redundant closures around InterpString::as_source, prefer indexing over get().unwrap() on the notifications HashMap - fabro-config/src/project.rs tests: switch the run.execution.retros fixture off raw string literal hashes (only simple content inside) and use ToString::to_string in the error-chain join expression --- lib/crates/fabro-config/src/config.rs | 6 ++++-- lib/crates/fabro-config/src/lib.rs | 1 - lib/crates/fabro-config/src/merge.rs | 25 +++++++++++++++++++------ lib/crates/fabro-config/src/project.rs | 6 +++--- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/lib/crates/fabro-config/src/config.rs b/lib/crates/fabro-config/src/config.rs index 1656b43d5..fa27d71bd 100644 --- a/lib/crates/fabro-config/src/config.rs +++ b/lib/crates/fabro-config/src/config.rs @@ -151,6 +151,8 @@ impl ConfigLayer { #[cfg(test)] mod tests { + use fabro_types::settings::v2::InterpString; + use super::*; #[test] @@ -179,7 +181,7 @@ goal = "Do things" .run .as_ref() .and_then(|r| r.goal.as_ref()) - .map(fabro_types::settings::v2::InterpString::as_source) + .map(InterpString::as_source) .as_deref(), Some("Do things") ); @@ -210,7 +212,7 @@ goal = "lower goal" .run .as_ref() .and_then(|r| r.goal.as_ref()) - .map(fabro_types::settings::v2::InterpString::as_source) + .map(InterpString::as_source) .as_deref(), Some("higher goal") ); diff --git a/lib/crates/fabro-config/src/lib.rs b/lib/crates/fabro-config/src/lib.rs index ea640c56b..526545afd 100644 --- a/lib/crates/fabro-config/src/lib.rs +++ b/lib/crates/fabro-config/src/lib.rs @@ -15,7 +15,6 @@ pub mod storage; pub mod user; pub use config::ConfigLayer; -pub use fabro_types::Combine; pub use fabro_util::path::expand_tilde; pub use home::Home; pub use storage::{RunScratch, ServerState, Storage}; diff --git a/lib/crates/fabro-config/src/merge.rs b/lib/crates/fabro-config/src/merge.rs index 2fdd3a47a..9ebc78077 100644 --- a/lib/crates/fabro-config/src/merge.rs +++ b/lib/crates/fabro-config/src/merge.rs @@ -479,8 +479,9 @@ fn combine_server_integrations( #[cfg(test)] mod tests { + use fabro_types::settings::v2::{InterpString, parse_settings_file}; + use super::*; - use fabro_types::settings::v2::parse_settings_file; fn parse(input: &str) -> SettingsFile { parse_settings_file(input).expect("fixture should parse") @@ -505,7 +506,7 @@ a = "higher" let inputs = merged.run.unwrap().inputs.unwrap(); assert_eq!(inputs.len(), 1); assert_eq!(inputs.get("a"), Some(&toml::Value::String("higher".into()))); - assert!(inputs.get("b").is_none(), "lower key should be gone"); + assert!(!inputs.contains_key("b"), "lower key should be gone"); } #[test] @@ -593,7 +594,11 @@ script = "higher-script" let hooks = merged.run.unwrap().hooks; assert_eq!(hooks.len(), 1); assert_eq!( - hooks[0].script.as_ref().map(|s| s.as_source()).as_deref(), + hooks[0] + .script + .as_ref() + .map(InterpString::as_source) + .as_deref(), Some("higher-script") ); } @@ -618,11 +623,19 @@ script = "higher-anon" let hooks = merged.run.unwrap().hooks; assert_eq!(hooks.len(), 2); assert_eq!( - hooks[0].script.as_ref().map(|s| s.as_source()).as_deref(), + hooks[0] + .script + .as_ref() + .map(InterpString::as_source) + .as_deref(), Some("lower-anon") ); assert_eq!( - hooks[1].script.as_ref().map(|s| s.as_source()).as_deref(), + hooks[1] + .script + .as_ref() + .map(InterpString::as_source) + .as_deref(), Some("higher-anon") ); } @@ -643,7 +656,7 @@ events = ["...", "run.completed"] ); let merged = combine_files(lower, higher); let run = merged.run.unwrap(); - let events = &run.notifications.get("ops").unwrap().events; + let events = &run.notifications["ops"].events; assert_eq!(events.len(), 2); } diff --git a/lib/crates/fabro-config/src/project.rs b/lib/crates/fabro-config/src/project.rs index 519e479d7..b04ac94a5 100644 --- a/lib/crates/fabro-config/src/project.rs +++ b/lib/crates/fabro-config/src/project.rs @@ -415,12 +415,12 @@ directory = "fabro/" #[test] fn parse_with_run_execution_retros() { let config = parse_project_config( - r#" + " _version = 1 [run.execution] retros = true -"#, +", ) .unwrap(); assert_eq!( @@ -449,7 +449,7 @@ retros = true let err = parse_project_config("_version = 2\n").unwrap_err(); let chain: String = err .chain() - .map(|e| e.to_string()) + .map(ToString::to_string) .collect::>() .join("; "); assert!(