From 815cc96a09b86eb890d6fa36d9afe8ed18afb867 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Thu, 6 Aug 2026 16:59:34 +0800 Subject: feat(pathf): remove BasicStructPattern from analyzer Remove the BasicStructPattern from pathf's pattern analyzer to eliminate noise from plain structs not associated with any Mingling macro. Also clean up the now-unused `basic_struct` module and update the integration test to assert plain structs are no longer collected. --- mingling_pathf/src/pattern_analyzer.rs | 1 - mingling_pathf/src/patterns.rs | 2 -- mingling_pathf/test/src/lib.rs | 4 +++- 3 files changed, 3 insertions(+), 4 deletions(-) (limited to 'mingling_pathf') diff --git a/mingling_pathf/src/pattern_analyzer.rs b/mingling_pathf/src/pattern_analyzer.rs index 4675dd1..1fc0cbe 100644 --- a/mingling_pathf/src/pattern_analyzer.rs +++ b/mingling_pathf/src/pattern_analyzer.rs @@ -28,7 +28,6 @@ pub fn init() -> PatternAnalyzer { /// to inject feature-dependent settings (e.g., `dispatch_tree`). pub fn init_with_config(config: PathfinderConfig) -> PatternAnalyzer { let mut analyzer = PatternAnalyzer::new(); - analyzer.add_pattern(BasicStructPattern); analyzer.add_pattern(PackPattern); analyzer.add_pattern(GroupPattern); analyzer.add_pattern(GroupedDerivePattern); diff --git a/mingling_pathf/src/patterns.rs b/mingling_pathf/src/patterns.rs index fcc50c3..29d757b 100644 --- a/mingling_pathf/src/patterns.rs +++ b/mingling_pathf/src/patterns.rs @@ -1,6 +1,5 @@ //! Mingling path matching patterns for command routing and field mapping. -pub use basic_struct::*; pub use chain::*; pub use command::*; pub use completion::*; @@ -13,7 +12,6 @@ pub use metadata::*; pub use pack::*; pub use renderer::*; -mod basic_struct; mod chain; mod command; mod completion; diff --git a/mingling_pathf/test/src/lib.rs b/mingling_pathf/test/src/lib.rs index 8b13e52..b543a15 100644 --- a/mingling_pathf/test/src/lib.rs +++ b/mingling_pathf/test/src/lib.rs @@ -58,7 +58,9 @@ fn test_pattern_analyzer_once() { let result = analyzer .analyze_file(dir.join("src/has_sub_mod.rs")) .unwrap(); - assert!(result.contains("::directly_sub_mod::DirectlySubModStruct")); + + // NO, basic_struct is disabled. + assert!(!result.contains("::directly_sub_mod::DirectlySubModStruct")); } #[test] -- cgit