Skip to content

Commit d1a627a

Browse files
Ran bless and rustfmt
1 parent 0b31b47 commit d1a627a

File tree

3 files changed

+42
-8
lines changed

3 files changed

+42
-8
lines changed

clippy_lints/src/from_str_radix_10.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use rustc_lint::{LateLintPass, LateContext};
2-
use rustc_session::{declare_lint_pass, declare_tool_lint};
3-
use rustc_hir::*;
4-
use rustc_errors::Applicability;
51
use if_chain::if_chain;
2+
use rustc_errors::Applicability;
3+
use rustc_hir::*;
4+
use rustc_lint::{LateContext, LateLintPass};
5+
use rustc_session::{declare_lint_pass, declare_tool_lint};
66

77
use crate::utils::span_lint_and_sugg;
88

@@ -16,7 +16,7 @@ declare_clippy_lint! {
1616
/// and complexity.
1717
///
1818
/// **Known problems:** None.
19-
///
19+
///
2020
/// **Example:**
2121
///
2222
/// ```rust
@@ -77,6 +77,6 @@ fn is_primitive_integer_ty(ty: PrimTy) -> bool {
7777
match ty {
7878
PrimTy::Int(_) => true,
7979
PrimTy::Uint(_) => true,
80-
_ => false
80+
_ => false,
8181
}
82-
}
82+
}

tests/ui/from_str_radix_10.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
3333
from_str_radix("50", 6)?;
3434

3535
Ok(())
36-
}
36+
}

tests/ui/from_str_radix_10.stderr

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
error: This call to `from_str_radix` can be shortened to a call to str::parse
2+
--> $DIR/from_str_radix_10.rs:17:5
3+
|
4+
LL | u32::from_str_radix("30", 10)?;
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `("30").parse()`
6+
|
7+
= note: `-D clippy::from-str-radix-10` implied by `-D warnings`
8+
9+
error: This call to `from_str_radix` can be shortened to a call to str::parse
10+
--> $DIR/from_str_radix_10.rs:18:5
11+
|
12+
LL | i64::from_str_radix("24", 10)?;
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `("24").parse()`
14+
15+
error: This call to `from_str_radix` can be shortened to a call to str::parse
16+
--> $DIR/from_str_radix_10.rs:19:5
17+
|
18+
LL | isize::from_str_radix("100", 10)?;
19+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `("100").parse()`
20+
21+
error: This call to `from_str_radix` can be shortened to a call to str::parse
22+
--> $DIR/from_str_radix_10.rs:20:5
23+
|
24+
LL | u8::from_str_radix("7", 10)?;
25+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `("7").parse()`
26+
27+
error: This call to `from_str_radix` can be shortened to a call to str::parse
28+
--> $DIR/from_str_radix_10.rs:23:5
29+
|
30+
LL | i32::from_str_radix(string, 10)?;
31+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(string).parse()`
32+
33+
error: aborting due to 5 previous errors
34+

0 commit comments

Comments
 (0)