Skip to content

Commit

Permalink
Add include_tests to the EqwalizerIncludes struct
Browse files Browse the repository at this point in the history
Summary:
As title.

Otherwise a NO-OP

Reviewed By: robertoaloi

Differential Revision: D65346240

fbshipit-source-id: 7eb413e30af9c28dd6d9b9f1913254bd8e6d8fa6
  • Loading branch information
alanz authored and facebook-github-bot committed Nov 4, 2024
1 parent 11b5d28 commit 71b5864
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions crates/elp/src/bin/eqwalizer_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<FileId> = module_index
.iter_own()
Expand Down Expand Up @@ -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<FileId> = module_index
.iter_own()
.filter_map(|(_name, _source, file_id)| {
Expand Down Expand Up @@ -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<FileId> = Default::default();
let mut at_least_one_found = false;
let exact_match = buck_target.contains(':');
Expand Down Expand Up @@ -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<FileId, (ModuleName, Vec<Diagnostic>)> = module_index
Expand Down
2 changes: 1 addition & 1 deletion crates/elp/src/bin/glean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,7 @@ impl GleanIndexer {
vars: FxHashMap<&Location, &String>,
) -> Vec<VarDecl> {
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]);
Expand Down
4 changes: 2 additions & 2 deletions crates/elp/src/bin/lint_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand All @@ -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()
{
Expand Down
2 changes: 1 addition & 1 deletion crates/elp/src/bin/reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions crates/elp/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(_) => {}
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions crates/elp/src/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()?
}

Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion crates/elp/tests/slow-tests/buck_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
));
Expand Down
2 changes: 1 addition & 1 deletion crates/ide/src/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions crates/ide_db/src/eqwalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ fn type_at_position(
db: &dyn EqwalizerDatabase,
range: FileRange,
) -> Option<Arc<(eqwalizer::types::Type, FileRange)>> {
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;
Expand Down Expand Up @@ -154,7 +154,7 @@ fn type_at_position(
}

fn types_for_file(db: &dyn EqwalizerDatabase, file_id: FileId) -> Option<Arc<Vec<(Pos, Type)>>> {
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;
Expand Down
8 changes: 4 additions & 4 deletions crates/types_db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
}
Expand Down

0 comments on commit 71b5864

Please sign in to comment.