Skip to content

Commit 64fe487

Browse files
committed
poly1305: add lint configs to Cargo.toml
Uses most of the standard lints we've applied elsewhere, with a couple of TODOs
1 parent 4d64c9a commit 64fe487

File tree

4 files changed

+46
-2
lines changed

4 files changed

+46
-2
lines changed

poly1305/Cargo.toml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,49 @@ cpufeatures = "0.3"
2222
[dev-dependencies]
2323
hex-literal = "1"
2424

25+
[lints.rust]
26+
missing_copy_implementations = "warn"
27+
missing_debug_implementations = "warn"
28+
missing_docs = "warn"
29+
trivial_casts = "warn"
30+
trivial_numeric_casts = "warn"
31+
unused_lifetimes = "warn"
32+
unused_qualifications = "warn"
33+
unreachable_pub = "warn"
34+
2535
[lints.rust.unexpected_cfgs]
2636
level = "warn"
2737
check-cfg = [
2838
'cfg(fuzzing)',
2939
'cfg(poly1305_backend, values("soft"))'
3040
]
41+
42+
[lints.clippy]
43+
borrow_as_ptr = "warn"
44+
cast_lossless = "warn"
45+
cast_possible_truncation = "allow" # TODO(tarcieri): warn
46+
cast_possible_wrap = "warn"
47+
cast_precision_loss = "warn"
48+
cast_sign_loss = "warn"
49+
checked_conversions = "warn"
50+
from_iter_instead_of_collect = "warn"
51+
implicit_saturating_sub = "warn"
52+
manual_assert = "warn"
53+
map_unwrap_or = "warn"
54+
missing_errors_doc = "warn"
55+
missing_panics_doc = "warn"
56+
mod_module_files = "warn"
57+
must_use_candidate = "warn"
58+
needless_range_loop = "allow"
59+
ptr_as_ptr = "warn"
60+
redundant_closure_for_method_calls = "warn"
61+
ref_as_ptr = "warn"
62+
return_self_not_must_use = "warn"
63+
semicolon_if_nothing_returned = "warn"
64+
trivially_copy_pass_by_ref = "warn"
65+
std_instead_of_alloc = "warn"
66+
std_instead_of_core = "warn"
67+
undocumented_unsafe_blocks = "warn"
68+
unnecessary_safety_comment = "warn"
69+
unwrap_in_result = "warn"
70+
unwrap_used = "allow" # TODO(tarcieri): warn

poly1305/benches/poly1305.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Poly1305 benchmarks.
2+
13
#![feature(test)]
24

35
extern crate test;

poly1305/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/8f1a9894/logo.svg",
55
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/8f1a9894/logo.svg"
66
)]
7-
#![warn(missing_docs)]
87

98
pub use universal_hash;
109

@@ -95,6 +94,7 @@ impl Poly1305 {
9594
/// Compute unpadded Poly1305 for the given input data.
9695
///
9796
/// The main use case for this is XSalsa20Poly1305.
97+
#[must_use]
9898
pub fn compute_unpadded(mut self, data: &[u8]) -> Tag {
9999
let (blocks, remaining) = Block::slice_as_chunks(data);
100100

poly1305/tests/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
//! Poly1305 integration tests.
2+
3+
use core::iter::repeat_n;
14
use hex_literal::hex;
25
use poly1305::{
36
Block, KEY_SIZE, Poly1305,
47
universal_hash::{KeyInit, UniversalHash},
58
};
6-
use std::iter::repeat_n;
79

810
#[test]
911
fn test_nacl_vector() {

0 commit comments

Comments
 (0)