Skip to content

Commit 5de7aa9

Browse files
committed
cmov: enable additional lints
Issues like #1300 could ideally be caught via more fastidious linting. This adds several additional lints and TODOs to address the ones which are currently failing.
1 parent a069771 commit 5de7aa9

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

cmov/src/aarch64.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ macro_rules! cseleq {
3737
};
3838
};
3939

40-
*$dst = tmp as u8;
40+
#[allow(clippy::cast_possible_truncation)]
41+
{
42+
*$dst = tmp as u8;
43+
}
4144
};
4245
}
4346

cmov/src/lib.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,18 @@
44
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg",
55
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg"
66
)]
7-
#![warn(missing_docs, unused_qualifications)]
7+
#![warn(
8+
clippy::cast_possible_truncation,
9+
clippy::integer_division_remainder_used,
10+
clippy::mod_module_files,
11+
missing_docs,
12+
missing_debug_implementations,
13+
missing_copy_implementations,
14+
rust_2018_idioms,
15+
trivial_casts,
16+
trivial_numeric_casts,
17+
unused_qualifications
18+
)]
819

920
#[cfg(not(miri))]
1021
#[cfg(target_arch = "aarch64")]
@@ -59,6 +70,8 @@ pub trait CmovEq {
5970
}
6071
}
6172

73+
// TODO(tarcieri): address truncation lint
74+
#[allow(clippy::cast_possible_truncation)]
6275
impl Cmov for u8 {
6376
#[inline]
6477
fn cmovnz(&mut self, value: &Self, condition: Condition) {
@@ -87,6 +100,8 @@ impl CmovEq for u8 {
87100
}
88101
}
89102

103+
// TODO(tarcieri): address truncation lint
104+
#[allow(clippy::cast_possible_truncation)]
90105
impl Cmov for u128 {
91106
#[inline]
92107
fn cmovnz(&mut self, value: &Self, condition: Condition) {
@@ -111,6 +126,8 @@ impl Cmov for u128 {
111126
}
112127
}
113128

129+
// TODO(tarcieri): address truncation lint
130+
#[allow(clippy::cast_possible_truncation)]
114131
impl CmovEq for u128 {
115132
#[inline]
116133
fn cmovne(&self, rhs: &Self, input: Condition, output: &mut Condition) {

0 commit comments

Comments
 (0)