Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): Treat clippy warnings as errors in CI #2684

Merged
merged 9 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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