@@ -4119,6 +4119,7 @@ pub struct Methods {
4119
4119
allow_expect_in_tests : bool ,
4120
4120
allow_unwrap_in_tests : bool ,
4121
4121
allowed_dotfiles : FxHashSet < String > ,
4122
+ allowed_external_crates : bool ,
4122
4123
}
4123
4124
4124
4125
impl Methods {
@@ -4129,6 +4130,7 @@ impl Methods {
4129
4130
allow_expect_in_tests : bool ,
4130
4131
allow_unwrap_in_tests : bool ,
4131
4132
mut allowed_dotfiles : FxHashSet < String > ,
4133
+ allowed_external_crates : bool ,
4132
4134
) -> Self {
4133
4135
allowed_dotfiles. extend ( DEFAULT_ALLOWED_DOTFILES . iter ( ) . map ( ToString :: to_string) ) ;
4134
4136
@@ -4138,6 +4140,7 @@ impl Methods {
4138
4140
allow_expect_in_tests,
4139
4141
allow_unwrap_in_tests,
4140
4142
allowed_dotfiles,
4143
+ allowed_external_crates,
4141
4144
}
4142
4145
}
4143
4146
}
@@ -4566,7 +4569,9 @@ impl Methods {
4566
4569
Some ( ( "bytes" , recv2, [ ] , _, _) ) => bytes_count_to_len:: check ( cx, expr, recv, recv2) ,
4567
4570
_ => { } ,
4568
4571
} ,
4569
- ( "min" | "max" , [ arg] ) => unnecessary_min_or_max:: check ( cx, expr, name, recv, arg) ,
4572
+ ( "min" | "max" , [ arg] ) => {
4573
+ unnecessary_min_or_max:: check ( cx, expr, name, recv, arg, self . allowed_external_crates )
4574
+ } ,
4570
4575
( "drain" , ..) => {
4571
4576
if let Node :: Stmt ( Stmt { hir_id : _, kind, .. } ) = cx. tcx . parent_hir_node ( expr. hir_id )
4572
4577
&& matches ! ( kind, StmtKind :: Semi ( _) )
0 commit comments