@@ -760,15 +760,17 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
760
760
if let Some ( first_arg) = iter_input_pats( & sig. decl, cx. tcx. hir. body( id) ) . next( ) ;
761
761
if let hir:: ItemImpl ( _, _, _, _, None , ref self_ty, _) = item. node;
762
762
then {
763
+ if cx. access_levels. is_exported( implitem. id) {
763
764
// check missing trait implementations
764
- for & ( method_name, n_args, self_kind, out_type, trait_name) in & TRAIT_METHODS {
765
- if name == method_name &&
766
- sig. decl. inputs. len( ) == n_args &&
767
- out_type. matches( & sig. decl. output) &&
768
- self_kind. matches( first_arg_ty, first_arg, self_ty, false , & implitem. generics) {
769
- span_lint( cx, SHOULD_IMPLEMENT_TRAIT , implitem. span, & format!(
770
- "defining a method called `{}` on this type; consider implementing \
771
- the `{}` trait or choosing a less ambiguous name", name, trait_name) ) ;
765
+ for & ( method_name, n_args, self_kind, out_type, trait_name) in & TRAIT_METHODS {
766
+ if name == method_name &&
767
+ sig. decl. inputs. len( ) == n_args &&
768
+ out_type. matches( & sig. decl. output) &&
769
+ self_kind. matches( first_arg_ty, first_arg, self_ty, false , & implitem. generics) {
770
+ span_lint( cx, SHOULD_IMPLEMENT_TRAIT , implitem. span, & format!(
771
+ "defining a method called `{}` on this type; consider implementing \
772
+ the `{}` trait or choosing a less ambiguous name", name, trait_name) ) ;
773
+ }
772
774
}
773
775
}
774
776
0 commit comments