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