diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index 6713f47690a1..7d370b4754c2 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -306,9 +306,15 @@ pub fn implements_trait<'a, 'tcx>( /// Use this if you want to find the `TraitRef` of the `Point` trait in this example: /// /// ```rust -/// trait Point; +/// struct Point(isize, isize); /// -/// impl std::ops::Add for Point {} +/// impl std::ops::Add for Point { +/// type Output = Self; +/// +/// fn add(self, other: Self) -> Self { +/// Point(0, 0) +/// } +/// } /// ``` pub fn trait_ref_of_method(cx: &LateContext<'_, '_>, hir_id: HirId) -> Option { // Get the implemented trait for the current function