From 8e23555bf1c34ac94eb92ca6a6e56c742077e1f2 Mon Sep 17 00:00:00 2001 From: ethan-000 Date: Tue, 22 Aug 2023 14:42:22 +0100 Subject: [PATCH 1/7] report warning first then error --- crates/noirc_errors/src/reporter.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/noirc_errors/src/reporter.rs b/crates/noirc_errors/src/reporter.rs index 8f4cdd9b551..f77d86d2c73 100644 --- a/crates/noirc_errors/src/reporter.rs +++ b/crates/noirc_errors/src/reporter.rs @@ -115,8 +115,18 @@ pub fn report_all( diagnostics: &[FileDiagnostic], deny_warnings: bool, ) -> ReportedErrors { + let mut ordered_diagonostics = Vec::new(); + let mut ordered_errors = Vec::new(); + for diagnostic in diagnostics { + if diagnostic.diagnostic.is_warning() { + ordered_diagonostics.push(diagnostic) + } else { + ordered_errors.push(diagnostic) + } + } + ordered_diagonostics.append(&mut ordered_errors); let error_count = - diagnostics.iter().map(|error| error.report(files, deny_warnings) as u32).sum(); + ordered_diagonostics.iter().map(|error| error.report(files, deny_warnings) as u32).sum(); ReportedErrors { error_count } } From e1a19dfd41b20b2a3a418cdccbe35844273c2e3b Mon Sep 17 00:00:00 2001 From: ethan-000 Date: Tue, 22 Aug 2023 14:44:37 +0100 Subject: [PATCH 2/7] clippy fixes --- crates/noirc_errors/src/reporter.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/noirc_errors/src/reporter.rs b/crates/noirc_errors/src/reporter.rs index f77d86d2c73..1fd482ed8b2 100644 --- a/crates/noirc_errors/src/reporter.rs +++ b/crates/noirc_errors/src/reporter.rs @@ -119,9 +119,9 @@ pub fn report_all( let mut ordered_errors = Vec::new(); for diagnostic in diagnostics { if diagnostic.diagnostic.is_warning() { - ordered_diagonostics.push(diagnostic) + ordered_diagonostics.push(diagnostic); } else { - ordered_errors.push(diagnostic) + ordered_errors.push(diagnostic); } } ordered_diagonostics.append(&mut ordered_errors); From 2aae2f41cf15861475153e7289a632cdb36fbfc7 Mon Sep 17 00:00:00 2001 From: ethan-000 Date: Tue, 22 Aug 2023 14:46:36 +0100 Subject: [PATCH 3/7] spelling fixes --- crates/noirc_errors/src/reporter.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/noirc_errors/src/reporter.rs b/crates/noirc_errors/src/reporter.rs index 1fd482ed8b2..9554fb37ff5 100644 --- a/crates/noirc_errors/src/reporter.rs +++ b/crates/noirc_errors/src/reporter.rs @@ -115,18 +115,18 @@ pub fn report_all( diagnostics: &[FileDiagnostic], deny_warnings: bool, ) -> ReportedErrors { - let mut ordered_diagonostics = Vec::new(); + let mut ordered_diagnostics = Vec::new(); let mut ordered_errors = Vec::new(); for diagnostic in diagnostics { if diagnostic.diagnostic.is_warning() { - ordered_diagonostics.push(diagnostic); + ordered_diagnostics.push(diagnostic); } else { ordered_errors.push(diagnostic); } } - ordered_diagonostics.append(&mut ordered_errors); + ordered_diagnostics.append(&mut ordered_errors); let error_count = - ordered_diagonostics.iter().map(|error| error.report(files, deny_warnings) as u32).sum(); + ordered_diagnostics.iter().map(|error| error.report(files, deny_warnings) as u32).sum(); ReportedErrors { error_count } } From 6676016323d86c22e23b7dd7fc8395fecb24d389 Mon Sep 17 00:00:00 2001 From: Ethan-000 Date: Tue, 22 Aug 2023 14:55:16 +0100 Subject: [PATCH 4/7] Update crates/noirc_errors/src/reporter.rs Co-authored-by: jfecher --- crates/noirc_errors/src/reporter.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/crates/noirc_errors/src/reporter.rs b/crates/noirc_errors/src/reporter.rs index 9554fb37ff5..d14fd2c66fd 100644 --- a/crates/noirc_errors/src/reporter.rs +++ b/crates/noirc_errors/src/reporter.rs @@ -115,15 +115,9 @@ pub fn report_all( diagnostics: &[FileDiagnostic], deny_warnings: bool, ) -> ReportedErrors { - let mut ordered_diagnostics = Vec::new(); - let mut ordered_errors = Vec::new(); - for diagnostic in diagnostics { - if diagnostic.diagnostic.is_warning() { - ordered_diagnostics.push(diagnostic); - } else { - ordered_errors.push(diagnostic); - } - } + // Report warnings before any errors + let (mut diagnostics, mut errors): (Vec<_>, _) = diagnostics.into_iter() + .partition(|item| item.diagnostic.is_warning()); ordered_diagnostics.append(&mut ordered_errors); let error_count = ordered_diagnostics.iter().map(|error| error.report(files, deny_warnings) as u32).sum(); From d2532ef21701cdfa2382975d1392749a80e6f9ea Mon Sep 17 00:00:00 2001 From: Ethan-000 Date: Tue, 22 Aug 2023 14:55:22 +0100 Subject: [PATCH 5/7] Update crates/noirc_errors/src/reporter.rs Co-authored-by: jfecher --- crates/noirc_errors/src/reporter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/noirc_errors/src/reporter.rs b/crates/noirc_errors/src/reporter.rs index d14fd2c66fd..5c6dc9075c4 100644 --- a/crates/noirc_errors/src/reporter.rs +++ b/crates/noirc_errors/src/reporter.rs @@ -120,7 +120,7 @@ pub fn report_all( .partition(|item| item.diagnostic.is_warning()); ordered_diagnostics.append(&mut ordered_errors); let error_count = - ordered_diagnostics.iter().map(|error| error.report(files, deny_warnings) as u32).sum(); + diagnostics.iter().map(|error| error.report(files, deny_warnings) as u32).sum(); ReportedErrors { error_count } } From 91bd77b017132ad8ec5f9a9ea970e965e799b892 Mon Sep 17 00:00:00 2001 From: Ethan-000 Date: Tue, 22 Aug 2023 14:55:28 +0100 Subject: [PATCH 6/7] Update crates/noirc_errors/src/reporter.rs Co-authored-by: jfecher --- crates/noirc_errors/src/reporter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/noirc_errors/src/reporter.rs b/crates/noirc_errors/src/reporter.rs index 5c6dc9075c4..898965a1a08 100644 --- a/crates/noirc_errors/src/reporter.rs +++ b/crates/noirc_errors/src/reporter.rs @@ -118,7 +118,7 @@ pub fn report_all( // Report warnings before any errors let (mut diagnostics, mut errors): (Vec<_>, _) = diagnostics.into_iter() .partition(|item| item.diagnostic.is_warning()); - ordered_diagnostics.append(&mut ordered_errors); + diagnostics.append(&mut errors); let error_count = diagnostics.iter().map(|error| error.report(files, deny_warnings) as u32).sum(); From b3d364718a8eec3e9c17dde0d69a863cc68ec5c2 Mon Sep 17 00:00:00 2001 From: ethan-000 Date: Tue, 22 Aug 2023 15:18:34 +0100 Subject: [PATCH 7/7] clippy --- crates/noirc_errors/src/reporter.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/noirc_errors/src/reporter.rs b/crates/noirc_errors/src/reporter.rs index 898965a1a08..d55189e80ac 100644 --- a/crates/noirc_errors/src/reporter.rs +++ b/crates/noirc_errors/src/reporter.rs @@ -116,8 +116,8 @@ pub fn report_all( deny_warnings: bool, ) -> ReportedErrors { // Report warnings before any errors - let (mut diagnostics, mut errors): (Vec<_>, _) = diagnostics.into_iter() - .partition(|item| item.diagnostic.is_warning()); + let (mut diagnostics, mut errors): (Vec<_>, _) = + diagnostics.iter().partition(|item| item.diagnostic.is_warning()); diagnostics.append(&mut errors); let error_count = diagnostics.iter().map(|error| error.report(files, deny_warnings) as u32).sum();