]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/inherent_to_string.rs
Auto merge of #4478 - tsurai:master, r=flip1995
[rust.git] / tests / ui / inherent_to_string.rs
index 9f81c027f4b0ef8d2c572fcff763ec4c6c092321..e6cf337d1bb1baa932b13f3665cdc8d7764395ee 100644 (file)
@@ -1,5 +1,6 @@
 #![warn(clippy::inherent_to_string)]
-#![deny(clippy::inherent_to_string_shadow)]
+#![deny(clippy::inherent_to_string_shadow_display)]
+#![allow(clippy::many_single_char_names)]
 
 use std::fmt;
 
@@ -12,6 +13,7 @@ trait FalsePositive {
 struct C;
 struct D;
 struct E;
+struct F;
 
 impl A {
     // Should be detected; emit warning
@@ -64,6 +66,13 @@ fn to_string() -> String {
     }
 }
 
+impl F {
+    // Should not be detected, as it does not match the function signature
+    fn to_string(&self, _i: i32) -> String {
+        "F.to_string()".to_string()
+    }
+}
+
 fn main() {
     let a = A;
     a.to_string();
@@ -81,4 +90,7 @@ fn main() {
     d.to_string();
 
     E::to_string();
+
+    let f = F;
+    f.to_string(1);
 }