Skip to content

Commit 042239d

Browse files
committed
Workspace-level lint configuration
Enables and fixes the same workspace-level lint configuration we originally implemented in RustCrypto/utils#1411, but for this repo. This primarily includes `clippy` lints, which have replaced the ones configured in individual lib.rs files. Since every crate in this repo previously declared `forbid(unsafe_code)` this has also been moved to the workspace-level.
1 parent fe63a2b commit 042239d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+164
-64
lines changed

.clippy.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
allow-unwrap-in-consts = true
2+
allow-unwrap-in-tests = true

Cargo.toml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,44 @@ members = [
1414

1515
[profile.dev]
1616
opt-level = 2
17+
18+
[workspace.lints.clippy]
19+
borrow_as_ptr = "warn"
20+
cast_lossless = "warn"
21+
cast_possible_truncation = "warn"
22+
cast_possible_wrap = "warn"
23+
cast_precision_loss = "warn"
24+
cast_sign_loss = "warn"
25+
checked_conversions = "warn"
26+
# doc_markdown = "warn"
27+
from_iter_instead_of_collect = "warn"
28+
implicit_saturating_sub = "warn"
29+
manual_assert = "warn"
30+
map_unwrap_or = "warn"
31+
missing_errors_doc = "warn"
32+
missing_panics_doc = "warn"
33+
mod_module_files = "warn"
34+
must_use_candidate = "warn"
35+
needless_range_loop = "allow"
36+
ptr_as_ptr = "warn"
37+
redundant_closure_for_method_calls = "warn"
38+
ref_as_ptr = "warn"
39+
return_self_not_must_use = "warn"
40+
semicolon_if_nothing_returned = "warn"
41+
trivially_copy_pass_by_ref = "warn"
42+
std_instead_of_alloc = "warn"
43+
std_instead_of_core = "warn"
44+
undocumented_unsafe_blocks = "warn"
45+
unnecessary_safety_comment = "warn"
46+
unwrap_in_result = "warn"
47+
unwrap_used = "warn"
48+
49+
[workspace.lints.rust]
50+
missing_copy_implementations = "warn"
51+
missing_debug_implementations = "warn"
52+
missing_docs = "warn"
53+
trivial_casts = "warn"
54+
trivial_numeric_casts = "warn"
55+
unsafe_code = "forbid"
56+
unused_lifetimes = "warn"
57+
unused_qualifications = "warn"

belt-ctr/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ cipher = { version = "0.5", features = ["dev"] }
2525
alloc = ["cipher/alloc"]
2626
zeroize = ["cipher/zeroize"]
2727

28+
[lints]
29+
workspace = true
30+
2831
[package.metadata.docs.rs]
2932
all-features = true
30-
rustdoc-args = ["--cfg", "docsrs"]

belt-ctr/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg",
55
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg"
66
)]
7-
#![forbid(unsafe_code)]
87
#![cfg_attr(docsrs, feature(doc_cfg))]
9-
#![warn(missing_debug_implementations, missing_docs, rust_2018_idioms)]
108

119
pub use cipher;
1210

@@ -58,7 +56,7 @@ where
5856
#[inline(always)]
5957
fn call<B: BlockCipherEncBackend<BlockSize = U16>>(self, cipher_backend: &B) {
6058
let Self { s, f } = self;
61-
f.call(&mut Backend { s, cipher_backend })
59+
f.call(&mut Backend { s, cipher_backend });
6260
}
6361
}
6462

cbc/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ alloc = ["cipher/alloc"]
2626
block-padding = ["cipher/block-padding"]
2727
zeroize = ["cipher/zeroize"]
2828

29+
[lints]
30+
workspace = true
31+
2932
[package.metadata.docs.rs]
3033
all-features = true
31-
rustdoc-args = ["--cfg", "docsrs"]

cbc/src/decrypt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ where
6666
}
6767

6868
let Self { cipher, iv } = self;
69-
cipher.decrypt_with_backend(Closure { iv, f })
69+
cipher.decrypt_with_backend(Closure { iv, f });
7070
}
7171
}
7272

@@ -188,7 +188,7 @@ where
188188
let n = t.len();
189189
xor(&mut t[0], self.iv);
190190
for i in 1..n {
191-
xor(&mut t[i], &in_blocks[i - 1])
191+
xor(&mut t[i], &in_blocks[i - 1]);
192192
}
193193
*blocks.get_out() = t;
194194
*self.iv = in_blocks[n - 1].clone();

cbc/src/encrypt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ where
100100
}
101101

102102
let Self { cipher, iv } = self;
103-
cipher.encrypt_with_backend(Closure { iv, f })
103+
cipher.encrypt_with_backend(Closure { iv, f });
104104
}
105105
}
106106

cbc/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,7 @@
9595
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg",
9696
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg"
9797
)]
98-
#![forbid(unsafe_code)]
9998
#![cfg_attr(docsrs, feature(doc_cfg))]
100-
#![warn(missing_debug_implementations, missing_docs, rust_2018_idioms)]
10199

102100
mod decrypt;
103101
mod encrypt;

cbc/tests/iv_state.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! IV state tests.
2+
13
use aes::*;
24
use cbc::{Decryptor, Encryptor};
35
use cipher::iv_state_test;

cfb-mode/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ alloc = ["cipher/alloc"]
2626
block-padding = ["cipher/block-padding"]
2727
zeroize = ["cipher/zeroize"]
2828

29+
[lints]
30+
workspace = true
31+
2932
[package.metadata.docs.rs]
3033
all-features = true
31-
rustdoc-args = ["--cfg", "docsrs"]

0 commit comments

Comments
 (0)