]>
git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/from_str_radix_10.rs
1 #![warn(clippy::from_str_radix_10)]
4 // fake function that shouldn't trigger the lint
5 pub fn from_str_radix(_
: &str, _
: u32) -> Result
<(), std
::num
::ParseIntError
> {
10 // fake function that shouldn't trigger the lint
11 fn from_str_radix(_
: &str, _
: u32) -> Result
<(), std
::num
::ParseIntError
> {
15 // to test parenthesis addition
18 impl std
::ops
::Add
<Test
> for Test
{
19 type Output
= &'
static str;
21 fn add(self, _
: Self) -> Self::Output
{
26 fn main() -> Result
<(), Box
<dyn std
::error
::Error
>> {
27 // all of these should trigger the lint
28 u32::from_str_radix("30", 10)?
;
29 i64::from_str_radix("24", 10)?
;
30 isize::from_str_radix("100", 10)?
;
31 u8::from_str_radix("7", 10)?
;
32 u16::from_str_radix(&("10".to_owned() + "5"), 10)?
;
33 i128
::from_str_radix(Test
+ Test
, 10)?
;
36 i32::from_str_radix(string
, 10)?
;
38 let stringier
= "400".to_string();
39 i32::from_str_radix(&stringier
, 10)?
;
41 // none of these should trigger the lint
42 u16::from_str_radix("20", 3)?
;
43 i32::from_str_radix("45", 12)?
;
44 usize::from_str_radix("10", 16)?
;
45 i128
::from_str_radix("10", 13)?
;
46 some_mod
::from_str_radix("50", 10)?
;
47 some_mod
::from_str_radix("50", 6)?
;
48 from_str_radix("50", 10)?
;
49 from_str_radix("50", 6)?
;