Skip to content

Commit

Permalink
chore(ci): Treat clippy warnings as errors in CI (#2684)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored Sep 15, 2023
1 parent 4b23abf commit 507c725
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ jobs:
name: cargo clippy
runs-on: ${{ matrix.runner }}
timeout-minutes: 30

env:
RUSTFLAGS: -Dwarnings

strategy:
fail-fast: false
matrix:
Expand All @@ -30,9 +32,8 @@ jobs:
uses: actions/checkout@v4

- name: Setup toolchain
uses: dtolnay/rust-toolchain@master
uses: dtolnay/rust-toolchain@1.66.0
with:
toolchain: stable # We do not use MSRV so we can benefit from newer lints
targets: ${{ matrix.target }}
components: clippy, rustfmt

Expand Down
18 changes: 9 additions & 9 deletions compiler/noirc_frontend/src/hir/def_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ impl CrateDefMap {
.iter()
.filter_map(|(id, module)| {
if module.is_contract {
let function_ids: Vec<FuncId> =
module.value_definitions().filter_map(|id| id.as_function()).collect();

let functions = function_ids
.into_iter()
.map(|id| {
let is_entry_point =
!interner.function_attributes(&id).has_contract_library_method();
ContractFunctionMeta { function_id: id, is_entry_point }
let functions = module
.value_definitions()
.filter_map(|id| {
id.as_function().map(|function_id| {
let is_entry_point = !interner
.function_attributes(&function_id)
.has_contract_library_method();
ContractFunctionMeta { function_id, is_entry_point }
})
})
.collect();

Expand Down
3 changes: 2 additions & 1 deletion compiler/noirc_frontend/src/hir/type_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,9 @@ mod test {
}

fn type_check_src_code(src: &str, func_namespace: Vec<String>) {
type_check_src_code_errors_expected(src, 0, func_namespace)
type_check_src_code_errors_expected(src, 0, func_namespace);
}

// This function assumes that there is only one function and this is the
// func id that is returned
fn type_check_src_code_errors_expected(
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/node_interner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ impl NodeInterner {
}

pub fn function_attributes(&self, func_id: &FuncId) -> Attributes {
self.function_meta(func_id).attributes.clone()
self.function_meta(func_id).attributes
}

/// Returns the interned statement corresponding to `stmt_id`
Expand Down

0 comments on commit 507c725

Please sign in to comment.