Skip to content

Commit 50133fb

Browse files
author
Michael Wright
committed
Merge branch 'master' into unnecessary_filter_map
2 parents f01fa22 + 37ba42b commit 50133fb

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

clippy_lints/src/excessive_precision.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@ impl ExcessivePrecision {
9898
}
9999
}
100100

101-
/// Should we exclude the float because it has a .0 suffix
101+
/// Should we exclude the float because it has a `.0` or `.` suffix
102102
/// Ex 1_000_000_000.0
103+
/// Ex 1_000_000_000.
103104
fn dot_zero_exclusion(s: &str) -> bool {
104105
if let Some(after_dec) = s.split('.').nth(1) {
105106
let mut decpart = after_dec
@@ -108,7 +109,8 @@ fn dot_zero_exclusion(s: &str) -> bool {
108109

109110
match decpart.next() {
110111
Some('0') => decpart.count() == 0,
111-
_ => false,
112+
Some(_) => false,
113+
None => true,
112114
}
113115
} else {
114116
false

rustc_tools_util/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#![feature(test)]
2-
#![feature(tool_lints)]
3-
41
use std::env;
52

63
#[macro_export]

tests/ui/excessive_precision.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,7 @@ fn main() {
5454

5555
let good_bige32: f32 = 1E-10;
5656
let bad_bige32: f32 = 1.123_456_788_888E-10;
57+
58+
// Inferred type
59+
let good_inferred: f32 = 1f32 * 1_000_000_000.;
5760
}

0 commit comments

Comments
 (0)