From 5b3a12412d8baaf875cf93153fdcd312c0e4f29e Mon Sep 17 00:00:00 2001 From: Mateusz Kowalski Date: Tue, 1 Oct 2024 11:13:40 +0200 Subject: [PATCH] Fix tests --- crates/cairo-lang-compiler/src/diagnostics.rs | 20 +++++++++++++++---- .../cairo-lang-diagnostics/src/diagnostics.rs | 6 +++++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/crates/cairo-lang-compiler/src/diagnostics.rs b/crates/cairo-lang-compiler/src/diagnostics.rs index ba751a0bf1a..3718553a2f6 100644 --- a/crates/cairo-lang-compiler/src/diagnostics.rs +++ b/crates/cairo-lang-compiler/src/diagnostics.rs @@ -124,7 +124,11 @@ impl<'a> DiagnosticsReporter<'a> { /// Returns the crate ids for which the diagnostics will be checked. fn crates_of_interest(&self, db: &dyn FilesGroup) -> Vec { - if self.crate_ids.is_empty() { db.crates() } else { self.crate_ids.clone() } + if self.crate_ids.is_empty() { + db.crates() + } else { + self.crate_ids.clone() + } } /// Checks if there are diagnostics. @@ -207,7 +211,7 @@ impl<'a> DiagnosticsReporter<'a> { let ignore_warnings_in_crate = self.ignore_warnings_crate_ids.contains(crate_id); let modules = db.crate_modules(*crate_id); for module_id in modules.iter() { - if let Ok(group) = db.module_semantic_diagnostics(*module_id) { + if let Ok(group) = db.module_lowering_diagnostics(*module_id) { found_diagnostics |= self.check_diag_group(db.upcast(), group, ignore_warnings_in_crate); } @@ -240,7 +244,11 @@ impl<'a> DiagnosticsReporter<'a> { /// Checks if there are diagnostics and reports them to the provided callback as strings. /// Returns `Err` if diagnostics were found. pub fn ensure(&mut self, db: &dyn LoweringGroup) -> Result<(), DiagnosticsError> { - if self.check(db) { Err(DiagnosticsError) } else { Ok(()) } + if self.check(db) { + Err(DiagnosticsError) + } else { + Ok(()) + } } /// Checks if there are diagnostics and reports them to the provided callback as strings. @@ -250,7 +258,11 @@ impl<'a> DiagnosticsReporter<'a> { &mut self, db: &dyn SemanticGroup, ) -> Result<(), DiagnosticsError> { - if self.check_common(db) { Err(DiagnosticsError) } else { Ok(()) } + if self.check_common(db) { + Err(DiagnosticsError) + } else { + Ok(()) + } } /// Spawns threads to compute the diagnostics queries, making sure later calls for these queries diff --git a/crates/cairo-lang-diagnostics/src/diagnostics.rs b/crates/cairo-lang-diagnostics/src/diagnostics.rs index 2c4b335273b..2da2b118c2c 100644 --- a/crates/cairo-lang-diagnostics/src/diagnostics.rs +++ b/crates/cairo-lang-diagnostics/src/diagnostics.rs @@ -268,7 +268,11 @@ impl Diagnostics { /// Returns Ok if there are no errors, or DiagnosticAdded if there are. pub fn check_error_free(&self) -> Maybe<()> { - if self.0.error_count == 0 { Ok(()) } else { Err(DiagnosticAdded) } + if self.0.error_count == 0 { + Ok(()) + } else { + Err(DiagnosticAdded) + } } /// Checks if there are no entries inside `Diagnostics`