diff --git a/crates/elp/src/bin/eqwalizer_cli.rs b/crates/elp/src/bin/eqwalizer_cli.rs index 02cf02182..6369ea038 100644 --- a/crates/elp/src/bin/eqwalizer_cli.rs +++ b/crates/elp/src/bin/eqwalizer_cli.rs @@ -144,7 +144,7 @@ pub fn do_eqwalize_all( set_eqwalizer_config(loaded, args.clause_coverage); let analysis = &loaded.analysis(); let module_index = analysis.module_index(loaded.project_id)?; - let eqwalizer_includes = EqwalizerIncludes::new().set_generated(args.include_generated.into()); + let eqwalizer_includes = EqwalizerIncludes::none().set_generated(args.include_generated.into()); let pb = cli.progress(module_index.len_own() as u64, "Gathering modules"); let file_ids: Vec = module_index .iter_own() @@ -212,7 +212,7 @@ pub fn do_eqwalize_app( set_eqwalizer_config(loaded, args.clause_coverage); let analysis = &loaded.analysis(); let module_index = analysis.module_index(loaded.project_id)?; - let eqwalizer_includes = EqwalizerIncludes::new().set_generated(args.include_generated.into()); + let eqwalizer_includes = EqwalizerIncludes::none().set_generated(args.include_generated.into()); let file_ids: Vec = module_index .iter_own() .filter_map(|(_name, _source, file_id)| { @@ -262,7 +262,7 @@ pub fn eqwalize_target( let buck_target = buck_target.strip_suffix(':').unwrap_or(buck_target); let analysis = &loaded.analysis(); - let eqwalizer_includes = EqwalizerIncludes::new().set_generated(args.include_generated.into()); + let eqwalizer_includes = EqwalizerIncludes::none().set_generated(args.include_generated.into()); let mut file_ids: Vec = Default::default(); let mut at_least_one_found = false; let exact_match = buck_target.contains(':'); @@ -330,7 +330,7 @@ pub fn eqwalize_stats( build::compile_deps(&loaded, cli)?; let analysis = &loaded.analysis(); let module_index = analysis.module_index(loaded.project_id)?; - let eqwalizer_includes = EqwalizerIncludes::new().set_generated(args.include_generated.into()); + let eqwalizer_includes = EqwalizerIncludes::none().set_generated(args.include_generated.into()); let project_id = loaded.project_id; let pb = cli.progress(module_index.len_own() as u64, "Computing stats"); let stats: FxHashMap)> = module_index diff --git a/crates/elp/src/bin/glean.rs b/crates/elp/src/bin/glean.rs index a80dd01fb..12d6fae29 100644 --- a/crates/elp/src/bin/glean.rs +++ b/crates/elp/src/bin/glean.rs @@ -1371,7 +1371,7 @@ impl GleanIndexer { vars: FxHashMap<&Location, &String>, ) -> Vec { let mut result = vec![]; - if !db.is_eqwalizer_enabled(file_id, EqwalizerIncludes::new()) { + if !db.is_eqwalizer_enabled(file_id, EqwalizerIncludes::none()) { return result; } let module_diagnostics = db.eqwalizer_diagnostics_by_project(project_id, vec![file_id]); diff --git a/crates/elp/src/bin/lint_cli.rs b/crates/elp/src/bin/lint_cli.rs index fcc680004..d7c0f23e5 100644 --- a/crates/elp/src/bin/lint_cli.rs +++ b/crates/elp/src/bin/lint_cli.rs @@ -195,7 +195,7 @@ fn do_parse_one( if let Some(diags) = db .eqwalizer_diagnostics_for_file( file_id, - EqwalizerIncludes::new().set_generated(args.include_generated.into()), + EqwalizerIncludes::none().set_generated(args.include_generated.into()), ) .unwrap() { @@ -207,7 +207,7 @@ fn do_parse_one( if let Some(diags) = db .eqwalizer_diagnostics_for_file( file_id, - EqwalizerIncludes::new().set_generated(args.include_generated.into()), + EqwalizerIncludes::none().set_generated(args.include_generated.into()), ) .unwrap() { diff --git a/crates/elp/src/bin/reporting.rs b/crates/elp/src/bin/reporting.rs index b4039845e..914be6e68 100644 --- a/crates/elp/src/bin/reporting.rs +++ b/crates/elp/src/bin/reporting.rs @@ -223,7 +223,7 @@ impl<'a> Reporter for JsonReporter<'a> { let line_index = self.analysis.line_index(file_id)?; let eqwalizer_enabled = self .analysis - .is_eqwalizer_enabled(file_id, EqwalizerIncludes::new().generated()) + .is_eqwalizer_enabled(file_id, EqwalizerIncludes::none().include_generated()) .unwrap(); let file_path = &self.loaded.vfs.file_path(file_id); let root_path = &self diff --git a/crates/elp/src/server.rs b/crates/elp/src/server.rs index 6b8548801..3a1496296 100644 --- a/crates/elp/src/server.rs +++ b/crates/elp/src/server.rs @@ -1533,7 +1533,7 @@ impl Server { let file_id = files.remove(files.len() - 1); match snapshot.update_cache_for_file( file_id, - EqwalizerIncludes::new(), + EqwalizerIncludes::none(), eqwalize_all, ) { Ok(_) => {} @@ -1574,7 +1574,7 @@ impl Server { for (_, _, file_id) in module_index.iter_own() { match snapshot .analysis - .should_eqwalize(file_id, EqwalizerIncludes::new()) + .should_eqwalize(file_id, EqwalizerIncludes::none()) { Ok(true) => { files.push(file_id); diff --git a/crates/elp/src/snapshot.rs b/crates/elp/src/snapshot.rs index 4d8794731..ff1c0355e 100644 --- a/crates/elp/src/snapshot.rs +++ b/crates/elp/src/snapshot.rs @@ -213,7 +213,7 @@ impl Snapshot { let file_url = self.file_id_to_url(file_id); let _timer = timeit_with_telemetry!(TelemetryData::EqwalizerDiagnostics { file_url }); self.analysis - .eqwalizer_diagnostics_for_file(file_id, EqwalizerIncludes::new().generated()) + .eqwalizer_diagnostics_for_file(file_id, EqwalizerIncludes::none().include_generated()) .ok()? } @@ -229,7 +229,7 @@ impl Snapshot { .filter_map(|(_, _, file_id)| { if let Ok(true) = self .analysis - .should_eqwalize(file_id, EqwalizerIncludes::new()) + .should_eqwalize(file_id, EqwalizerIncludes::none()) { Some(file_id) } else { diff --git a/crates/elp/tests/slow-tests/buck_tests.rs b/crates/elp/tests/slow-tests/buck_tests.rs index af46c446c..223a3aa68 100644 --- a/crates/elp/tests/slow-tests/buck_tests.rs +++ b/crates/elp/tests/slow-tests/buck_tests.rs @@ -71,7 +71,7 @@ mod tests { .unwrap(); assert_eq!(ast.errors, vec![]); let eq_enabled = analysis - .is_eqwalizer_enabled(file_id, EqwalizerIncludes::new()) + .is_eqwalizer_enabled(file_id, EqwalizerIncludes::none()) .expect(&format!( "Failed to check if eqwalizer enabled for {module}" )); diff --git a/crates/ide/src/fixture.rs b/crates/ide/src/fixture.rs index 920e651db..629bc4ef2 100644 --- a/crates/ide/src/fixture.rs +++ b/crates/ide/src/fixture.rs @@ -137,7 +137,7 @@ pub fn diagnostics_for( } } if *use_eqwalizer { - let eqwalizer_includes = EqwalizerIncludes::new().generated(); + let eqwalizer_includes = EqwalizerIncludes::none().include_generated(); if let Some(diags) = analysis .eqwalizer_diagnostics_for_file(file_id, eqwalizer_includes) .unwrap() diff --git a/crates/ide_db/src/eqwalizer.rs b/crates/ide_db/src/eqwalizer.rs index 00f59e219..1d347a7c0 100644 --- a/crates/ide_db/src/eqwalizer.rs +++ b/crates/ide_db/src/eqwalizer.rs @@ -119,7 +119,7 @@ fn type_at_position( db: &dyn EqwalizerDatabase, range: FileRange, ) -> Option> { - if !db.is_eqwalizer_enabled(range.file_id, EqwalizerIncludes::new().generated()) { + if !db.is_eqwalizer_enabled(range.file_id, EqwalizerIncludes::none().include_generated()) { return None; } let project_id = db.file_app_data(range.file_id)?.project_id; @@ -154,7 +154,7 @@ fn type_at_position( } fn types_for_file(db: &dyn EqwalizerDatabase, file_id: FileId) -> Option>> { - if !db.is_eqwalizer_enabled(file_id, EqwalizerIncludes::new().generated()) { + if !db.is_eqwalizer_enabled(file_id, EqwalizerIncludes::none().include_generated()) { return None; } let project_id = db.file_app_data(file_id)?.project_id; diff --git a/crates/types_db/src/lib.rs b/crates/types_db/src/lib.rs index d324ea913..0a1032a80 100644 --- a/crates/types_db/src/lib.rs +++ b/crates/types_db/src/lib.rs @@ -32,14 +32,14 @@ pub struct EqwalizerIncludes { } impl EqwalizerIncludes { - pub fn new() -> EqwalizerIncludes { + pub fn none() -> EqwalizerIncludes { EqwalizerIncludes { include_generated: IncludeGenerated::No, include_tests: IncludeTests::No, } } - pub fn generated(mut self) -> EqwalizerIncludes { + pub fn include_generated(mut self) -> EqwalizerIncludes { self.include_generated = IncludeGenerated::Yes; self } @@ -49,8 +49,8 @@ impl EqwalizerIncludes { self } - pub fn tests(mut self) -> EqwalizerIncludes { - self.include_generated = IncludeGenerated::Yes; + pub fn include_tests(mut self) -> EqwalizerIncludes { + self.include_tests = IncludeTests::Yes; self } }