File tree Expand file tree Collapse file tree 1 file changed +15
-16
lines changed Expand file tree Collapse file tree 1 file changed +15
-16
lines changed Original file line number Diff line number Diff line change @@ -37,22 +37,21 @@ declare_lint_pass!(IgnoredUnitPatterns => [IGNORED_UNIT_PATTERNS]);
3737
3838impl < ' tcx > LateLintPass < ' tcx > for IgnoredUnitPatterns {
3939 fn check_pat ( & mut self , cx : & LateContext < ' tcx > , pat : & ' tcx hir:: Pat < ' tcx > ) {
40- if pat. span . from_expansion ( ) {
41- return ;
42- }
43-
44- match cx. tcx . parent_hir_node ( pat. hir_id ) {
45- Node :: Param ( param) if matches ! ( cx. tcx. parent_hir_node( param. hir_id) , Node :: Item ( _) ) => {
46- // Ignore function parameters
47- return ;
48- } ,
49- Node :: LetStmt ( local) if local. ty . is_some ( ) => {
50- // Ignore let bindings with explicit type
51- return ;
52- } ,
53- _ => { } ,
54- }
55- if matches ! ( pat. kind, PatKind :: Wild ) && cx. typeck_results ( ) . pat_ty ( pat) . peel_refs ( ) . is_unit ( ) {
40+ if matches ! ( pat. kind, PatKind :: Wild )
41+ && !pat. span . from_expansion ( )
42+ && cx. typeck_results ( ) . pat_ty ( pat) . peel_refs ( ) . is_unit ( )
43+ {
44+ match cx. tcx . parent_hir_node ( pat. hir_id ) {
45+ Node :: Param ( param) if matches ! ( cx. tcx. parent_hir_node( param. hir_id) , Node :: Item ( _) ) => {
46+ // Ignore function parameters
47+ return ;
48+ } ,
49+ Node :: LetStmt ( local) if local. ty . is_some ( ) => {
50+ // Ignore let bindings with explicit type
51+ return ;
52+ } ,
53+ _ => { } ,
54+ }
5655 span_lint_and_sugg (
5756 cx,
5857 IGNORED_UNIT_PATTERNS ,
You can’t perform that action at this time.
0 commit comments