File tree 3 files changed +13
-14
lines changed
ui-toml/toml_disallowed_method
3 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ declare_clippy_lint! {
27
27
/// ```
28
28
pub DISALLOWED_METHOD ,
29
29
nursery,
30
- "used disallowed method call"
30
+ "use of a disallowed method call"
31
31
}
32
32
33
33
#[ derive( Clone , Debug ) ]
@@ -55,18 +55,17 @@ impl<'tcx> LateLintPass<'tcx> for DisallowedMethod {
55
55
56
56
let method_call = cx. get_def_path ( def_id) ;
57
57
if self . disallowed . contains ( & method_call) {
58
+ let method = method_call
59
+ . iter ( )
60
+ . map ( |s| s. to_ident_string ( ) )
61
+ . collect :: < Vec < _ > > ( )
62
+ . join ( "::" ) ;
63
+
58
64
span_lint (
59
65
cx,
60
66
DISALLOWED_METHOD ,
61
67
expr. span ,
62
- & format ! (
63
- "Use of a disallowed method `{}`" ,
64
- method_call
65
- . iter( )
66
- . map( |s| s. to_ident_string( ) )
67
- . collect:: <Vec <_>>( )
68
- . join( "::" ) ,
69
- ) ,
68
+ & format ! ( "use of a disallowed method `{}`" , method) ,
70
69
) ;
71
70
}
72
71
}
Original file line number Diff line number Diff line change 1
- error: Use of a disallowed method `regex::re_unicode::Regex::is_match`
1
+ error: use of a disallowed method `regex::re_unicode::Regex::is_match`
2
2
--> $DIR/conf_disallowed_method.rs:10:5
3
3
|
4
4
LL | re.is_match("abc");
5
5
| ^^^^^^^^^^^^^^^^^^
6
6
|
7
7
= note: `-D clippy::disallowed-method` implied by `-D warnings`
8
8
9
- error: Use of a disallowed method `core::iter::traits::iterator::Iterator::sum`
9
+ error: use of a disallowed method `core::iter::traits::iterator::Iterator::sum`
10
10
--> $DIR/conf_disallowed_method.rs:12:5
11
11
|
12
12
LL | a.iter().sum::<i32>();
Original file line number Diff line number Diff line change 1
- error: Use of a disallowed method `disallowed_method::Baz::bad_method`
1
+ error: use of a disallowed method `disallowed_method::Baz::bad_method`
2
2
--> $DIR/disallowed_method.rs:48:5
3
3
|
4
4
LL | b.bad_method();
5
5
| ^^^^^^^^^^^^^^
6
6
|
7
7
= note: `-D clippy::disallowed-method` implied by `-D warnings`
8
8
9
- error: Use of a disallowed method `disallowed_method::Baz::bad_method`
9
+ error: use of a disallowed method `disallowed_method::Baz::bad_method`
10
10
--> $DIR/disallowed_method.rs:49:5
11
11
|
12
12
LL | c.bad_method();
13
13
| ^^^^^^^^^^^^^^
14
14
15
- error: Use of a disallowed method `disallowed_method::Foo::bad_method`
15
+ error: use of a disallowed method `disallowed_method::Foo::bad_method`
16
16
--> $DIR/disallowed_method.rs:50:5
17
17
|
18
18
LL | f.bad_method();
You can’t perform that action at this time.
0 commit comments