Changed applicability to MaybeIncorrect because of surrounding braces

This commit is contained in:
boolean_coercion 2021-02-11 12:42:20 +02:00
parent a389c02461
commit 0b31b470ad
2 changed files with 4 additions and 1 deletions

View file

@ -66,7 +66,7 @@ impl LateLintPass<'tcx> for FromStrRadix10 {
"This call to `from_str_radix` can be shortened to a call to str::parse",
"try",
format!("({}).parse()", orig_string),
Applicability::MachineApplicable
Applicability::MaybeIncorrect
);
}
}

View file

@ -19,6 +19,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
isize::from_str_radix("100", 10)?;
u8::from_str_radix("7", 10)?;
let string = "300";
i32::from_str_radix(string, 10)?;
// none of these should trigger the lint
u16::from_str_radix("20", 3)?;
i32::from_str_radix("45", 12)?;