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

Clippy in Regressions. #1403

Merged
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
96c5055
Added jq for json querying.
YoshikiTakashima Jul 22, 2022
0547a1d
Added clippy to regression.
YoshikiTakashima Jul 22, 2022
ba12b55
Added error ignore and todo to kani-compiler.
YoshikiTakashima Jul 22, 2022
e7b194d
Added clippy todo to cprover_bindings.
YoshikiTakashima Jul 22, 2022
a731fa5
Forced failure on warnings (Werror for clippy).
YoshikiTakashima Jul 22, 2022
05b7728
Added clippy todo to compiletest.
YoshikiTakashima Jul 23, 2022
476c88c
Clippy supression for bookrunner.
YoshikiTakashima Jul 23, 2022
0846e95
Resolved metadata warnings with publish = false.
YoshikiTakashima Jul 23, 2022
dfb712a
Clippy todo for kani library.
YoshikiTakashima Jul 23, 2022
5b0c159
Clippy todos and publish fix for kani_macros.
YoshikiTakashima Jul 23, 2022
7f6d50c
Cargo fmt.
YoshikiTakashima Jul 23, 2022
7db5b7d
Merge branch 'main' of github.com:model-checking/kani into yoshi-clip…
YoshikiTakashima Jul 23, 2022
1832866
Temporally turned off clippy fail.
YoshikiTakashima Jul 25, 2022
2bc5ead
Merge branch 'main' into yoshi-clippy-compliance
YoshikiTakashima Jul 25, 2022
df626cf
Moved clippy to format checks.
YoshikiTakashima Jul 25, 2022
0885ef8
Merge branch 'yoshi-clippy-compliance' of github.com:YoshikiTakashima…
YoshikiTakashima Jul 25, 2022
f89f24b
Moved clippy to the format check.
YoshikiTakashima Jul 25, 2022
9fd5572
Added missing dependency.
YoshikiTakashima Jul 25, 2022
5c0a918
Fixed yaml overwrite problem.
YoshikiTakashima Jul 25, 2022
37cd803
Gather stats on clippy warnings.
YoshikiTakashima Jul 25, 2022
7803971
jq install for osx not needed.
YoshikiTakashima Jul 25, 2022
f3d9252
Moved clippy control to a central config file.
YoshikiTakashima Jul 25, 2022
2985448
Fixed clippy warnings under library/
YoshikiTakashima Jul 25, 2022
27557a0
Adjusted actions to print stats by removing lint supression.
YoshikiTakashima Jul 25, 2022
a363270
Merge branch 'main' of github.com:model-checking/kani into yoshi-clip…
YoshikiTakashima Jul 25, 2022
6ed0866
Ignored 3 clippy warnings that regressed after merge.
YoshikiTakashima Jul 25, 2022
cf7a0ff
Forgot to remove manual -A
YoshikiTakashima Jul 25, 2022
19c39e4
Merge branch 'main' of github.com:model-checking/kani into yoshi-clip…
YoshikiTakashima Jul 25, 2022
88a98da
got rid of redundant allowed lints.
YoshikiTakashima Jul 26, 2022
b7e46ba
Merge branch 'main' into yoshi-clippy-compliance
YoshikiTakashima Jul 26, 2022
455c42f
Moved jq install to workflow side.
YoshikiTakashima Jul 26, 2022
806c3db
removed .cargo from gitignore
YoshikiTakashima Jul 26, 2022
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
39 changes: 39 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright Kani Contributors
# SPDX-License-Identifier: Apache-2.0 OR MIT

[target.'cfg(all())']
rustflags = [ # Global lints/warnings. Need to use underscore instead of -.

# Purposefully disabled lints
"-Aclippy::expect_fun_call",
"-Aclippy::or_fun_call",

# todo address the following lints.
"-Aclippy::cargo_common_metadata",
"-Aclippy::derive_partial_eq_without_eq",
"-Aclippy::expect_fun_call",
"-Aclippy::explicit_auto_deref",
"-Aclippy::if_same_then_else",
"-Aclippy::iter_nth_zero",
"-Aclippy::let_and_return",
"-Aclippy::manual_map",
"-Aclippy::manual_range_contains",
"-Aclippy::manual_strip",
"-Aclippy::map_entry",
"-Aclippy::match_like_matches_macro",
"-Aclippy::missing_safety_doc",
"-Aclippy::module_inception",
"-Aclippy::needless_arbitrary_self_type",
"-Aclippy::needless_bool",
"-Aclippy::needless_return",
"-Aclippy::new_ret_no_self",
"-Aclippy::new_without_default",
"-Aclippy::or_fun_call",
YoshikiTakashima marked this conversation as resolved.
Show resolved Hide resolved
"-Aclippy::redundant_clone",
"-Aclippy::too_many_arguments",
"-Aclippy::type_complexity",
"-Aclippy::unnecessary_lazy_evaluations",
"-Aclippy::useless_conversion",
"-Aclippy::needless_borrow",
"-Aclippy::unnecessary_filter_map",
]
22 changes: 22 additions & 0 deletions .github/workflows/format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,25 @@ jobs:
run: |
pip3 install --upgrade autopep8
./scripts/run-autopep8.sh

clippy-check:
runs-on: ubuntu-20.04
steps:
- name: Checkout Kani
uses: actions/checkout@v2

- name: Setup Kani Dependencies
uses: ./.github/actions/setup
with:
os: ubuntu-20.04

- name: "Run Clippy"
run: |
cargo clippy --all -- -D warnings

- name: "Print Clippy Statistics"
run: |
rm .cargo/config.toml
(cargo clippy --all --message-format=json 2>/dev/null | \
jq 'select(.message!=null) | .message.code.code' | grep -v '^null$' | \
sort | uniq -c) || true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Session.vim
## Tool
.valgrindrc
.cargo
!/.cargo
YoshikiTakashima marked this conversation as resolved.
Show resolved Hide resolved
# Included because it is part of the test case
!/test/run-make/thumb-none-qemu/example/.cargo

Expand Down
1 change: 1 addition & 0 deletions cprover_bindings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ name = "cprover_bindings"
version = "0.6.0"
edition = "2021"
license = "MIT OR Apache-2.0"
publish = false

[lib]
test = true
Expand Down
1 change: 1 addition & 0 deletions kani-compiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ name = "kani-compiler"
version = "0.6.0"
edition = "2021"
license = "MIT OR Apache-2.0"
publish = false

[dependencies]
ar = { version = "0.9.0", optional = true }
Expand Down
1 change: 1 addition & 0 deletions kani-compiler/kani_queries/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ name = "kani_queries"
version = "0.6.0"
edition = "2021"
license = "MIT OR Apache-2.0"
publish = false

[dependencies]
tracing = {version = "0.1"}
Expand Down
1 change: 1 addition & 0 deletions kani-driver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ description = "Build a project with Kani and run all proof harnesses"
license = "MIT OR Apache-2.0"
homepage = "https://github.com/model-checking/kani"
repository = "https://github.com/model-checking/kani"
publish = false

[dependencies]
kani_metadata = { path = "../kani_metadata" }
Expand Down
1 change: 1 addition & 0 deletions kani_metadata/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ name = "kani_metadata"
version = "0.6.0"
edition = "2021"
license = "MIT OR Apache-2.0"
publish = false

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
1 change: 1 addition & 0 deletions library/kani/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ name = "kani"
version = "0.6.0"
edition = "2021"
license = "MIT OR Apache-2.0"
publish = false

[dependencies]
kani_macros = { path = "../kani_macros" }
2 changes: 1 addition & 1 deletion library/kani/src/invariant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ unsafe impl Invariant for char {
fn is_valid(&self) -> bool {
// Kani translates char into i32.
let val = *self as i32;
val <= 0xD7FF || (val >= 0xE000 && val <= 0x10FFFF)
val <= 0xD7FF || (0xE000..=0x10FFFF).contains(&val)
}
}

Expand Down
4 changes: 4 additions & 0 deletions library/kani/src/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ where
AnySlice::<T, MAX_SLICE_LENGTH>::new()
}

/// # Safety
///
/// TODO: Safety of any_raw_slice is a complex matter. See
/// https://github.com/model-checking/kani/issues/1394
pub unsafe fn any_raw_slice<T, const MAX_SLICE_LENGTH: usize>() -> AnySlice<T, MAX_SLICE_LENGTH> {
AnySlice::<T, MAX_SLICE_LENGTH>::new_raw()
}
1 change: 1 addition & 0 deletions library/kani_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ name = "kani_macros"
version = "0.6.0"
edition = "2021"
license = "MIT OR Apache-2.0"
publish = false

[lib]
proc-macro = true
Expand Down
4 changes: 2 additions & 2 deletions library/kani_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub fn proof(_attr: TokenStream, item: TokenStream) -> TokenStream {
pub fn proof(attr: TokenStream, item: TokenStream) -> TokenStream {
let mut result = TokenStream::new();

assert!(attr.to_string().len() == 0, "#[kani::proof] does not take any arguments");
assert!(attr.to_string().is_empty(), "#[kani::proof] does not take any arguments");
result.extend("#[kanitool::proof]".parse::<TokenStream>().unwrap());
// no_mangle is a temporary hack to make the function "public" so it gets codegen'd
result.extend("#[no_mangle]".parse::<TokenStream>().unwrap());
Expand Down Expand Up @@ -67,7 +67,7 @@ pub fn unwind(attr: TokenStream, item: TokenStream) -> TokenStream {
let mut result = TokenStream::new();

// Translate #[kani::unwind(arg)] to #[kanitool::unwind(arg)]
let insert_string = "#[kanitool::unwind(".to_owned() + &attr.clone().to_string() + ")]";
let insert_string = "#[kanitool::unwind(".to_owned() + &attr.to_string() + ")]";
result.extend(insert_string.parse::<TokenStream>().unwrap());

result.extend(item);
Expand Down
1 change: 1 addition & 0 deletions library/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ name = "std"
version = "0.6.0"
edition = "2021"
license = "MIT OR Apache-2.0"
publish = false

[dependencies]
kani = {path="../kani"}
1 change: 1 addition & 0 deletions scripts/setup/ubuntu/install_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ DEPS=(
wget
zlib1g
zlib1g-dev
jq
YoshikiTakashima marked this conversation as resolved.
Show resolved Hide resolved
)

# Version specific dependencies.
Expand Down
1 change: 1 addition & 0 deletions tools/bookrunner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ name = "bookrunner"
version = "0.1.0"
edition = "2018"
license = "MIT OR Apache-2.0"
publish = false

[dependencies]
Inflector = "0.11.4"
Expand Down
2 changes: 2 additions & 0 deletions tools/bookrunner/librustdoc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ name = "rustdoc"
version = "0.0.0"
edition = "2021"
license = "MIT OR Apache-2.0"
publish = false

# From upstream librustdoc:
# https://github.com/rust-lang/rust/tree/master/src/librustdoc
# Upstream crate does not list license but Rust statues:
Expand Down
1 change: 1 addition & 0 deletions tools/compiletest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ name = "compiletest"
version = "0.0.0"
edition = "2021"
license = "MIT OR Apache-2.0"
publish = false
# From upstream compiletest:
# https://github.com/rust-lang/rust/tree/master/src/tools/compiletest
# Upstream crate does not list license but Rust statues:
Expand Down
1 change: 1 addition & 0 deletions tools/make-kani-release/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ version = "0.1.0"
edition = "2021"
description = "Contructs a Kani release bundle"
license = "MIT OR Apache-2.0"
publish = false

[dependencies]
anyhow = "1"
Expand Down