diff --git a/clippy_lints/src/from_str_radix_10.rs b/clippy_lints/src/from_str_radix_10.rs index 57661e0f9..9371104bf 100644 --- a/clippy_lints/src/from_str_radix_10.rs +++ b/clippy_lints/src/from_str_radix_10.rs @@ -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 ); } } diff --git a/tests/ui/from_str_radix_10.rs b/tests/ui/from_str_radix_10.rs index 086616d09..795e795fc 100644 --- a/tests/ui/from_str_radix_10.rs +++ b/tests/ui/from_str_radix_10.rs @@ -19,6 +19,9 @@ fn main() -> Result<(), Box> { 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)?;