File tree Expand file tree Collapse file tree 3 files changed +13
-14
lines changed
ui-toml/toml_disallowed_method Expand file tree Collapse file tree 3 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ declare_clippy_lint! {
2727 /// ```
2828 pub DISALLOWED_METHOD ,
2929 nursery,
30- "used disallowed method call"
30+ "use of a disallowed method call"
3131}
3232
3333#[ derive( Clone , Debug ) ]
@@ -55,18 +55,17 @@ impl<'tcx> LateLintPass<'tcx> for DisallowedMethod {
5555
5656 let method_call = cx. get_def_path ( def_id) ;
5757 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+
5864 span_lint (
5965 cx,
6066 DISALLOWED_METHOD ,
6167 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) ,
7069 ) ;
7170 }
7271 }
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`
22 --> $DIR/conf_disallowed_method.rs:10:5
33 |
44LL | re.is_match("abc");
55 | ^^^^^^^^^^^^^^^^^^
66 |
77 = note: `-D clippy::disallowed-method` implied by `-D warnings`
88
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`
1010 --> $DIR/conf_disallowed_method.rs:12:5
1111 |
1212LL | 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`
22 --> $DIR/disallowed_method.rs:48:5
33 |
44LL | b.bad_method();
55 | ^^^^^^^^^^^^^^
66 |
77 = note: `-D clippy::disallowed-method` implied by `-D warnings`
88
9- error: Use of a disallowed method `disallowed_method::Baz::bad_method`
9+ error: use of a disallowed method `disallowed_method::Baz::bad_method`
1010 --> $DIR/disallowed_method.rs:49:5
1111 |
1212LL | c.bad_method();
1313 | ^^^^^^^^^^^^^^
1414
15- error: Use of a disallowed method `disallowed_method::Foo::bad_method`
15+ error: use of a disallowed method `disallowed_method::Foo::bad_method`
1616 --> $DIR/disallowed_method.rs:50:5
1717 |
1818LL | f.bad_method();
You can’t perform that action at this time.
0 commit comments