about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-01-13 12:07:28 +0000
committerbors <bors@rust-lang.org>2023-01-13 12:07:28 +0000
commita119352adab65d0cab25c13ae0fd7676bed7100f (patch)
tree51ec72e918728a3c183d8cae21ee897f3efdc004
parent15fb082cc1d66c2934097b1f5ec1cd9e8b75edcb (diff)
parentc4b36b64aae0d5bace5d19e0fbd64d1db9114bf9 (diff)
downloadrust-a119352adab65d0cab25c13ae0fd7676bed7100f.tar.gz
rust-a119352adab65d0cab25c13ae0fd7676bed7100f.zip
Auto merge of #13937 - danieleades:recursive-display, r=lnicola
remove recursive 'Display' implementations

closes #13920

`@lnicola` is this the solution you were looking for?

having explicitly unimplemented methods seems preferable to apparently implemented methods that can't be called
-rw-r--r--crates/proc-macro-srv/src/abis/abi_1_58/proc_macro/mod.rs24
-rw-r--r--crates/proc-macro-srv/src/abis/abi_1_63/proc_macro/mod.rs24
2 files changed, 24 insertions, 24 deletions
diff --git a/crates/proc-macro-srv/src/abis/abi_1_58/proc_macro/mod.rs b/crates/proc-macro-srv/src/abis/abi_1_58/proc_macro/mod.rs
index c5145d00e32..a94b909941d 100644
--- a/crates/proc-macro-srv/src/abis/abi_1_58/proc_macro/mod.rs
+++ b/crates/proc-macro-srv/src/abis/abi_1_58/proc_macro/mod.rs
@@ -123,8 +123,8 @@ impl FromStr for TokenStream {
 /// into the same token stream (modulo spans), except for possibly `TokenTree::Group`s
 /// with `Delimiter::None` delimiters and negative numeric literals.
 impl fmt::Display for TokenStream {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        f.write_str(&self.to_string())
+    fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        unimplemented!()
     }
 }
 
@@ -522,8 +522,8 @@ impl From<Literal> for TokenTree {
 /// into the same token tree (modulo spans), except for possibly `TokenTree::Group`s
 /// with `Delimiter::None` delimiters and negative numeric literals.
 impl fmt::Display for TokenTree {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        f.write_str(&self.to_string())
+    fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        unimplemented!()
     }
 }
 
@@ -619,8 +619,8 @@ impl Group {
 /// into the same group (modulo spans), except for possibly `TokenTree::Group`s
 /// with `Delimiter::None` delimiters.
 impl fmt::Display for Group {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        f.write_str(&self.to_string())
+    fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        unimplemented!()
     }
 }
 
@@ -693,8 +693,8 @@ impl Punct {
 /// Prints the punctuation character as a string that should be losslessly convertible
 /// back into the same character.
 impl fmt::Display for Punct {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        f.write_str(&self.to_string())
+    fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        unimplemented!()
     }
 }
 
@@ -771,8 +771,8 @@ impl Ident {
 /// Prints the identifier as a string that should be losslessly convertible
 /// back into the same identifier.
 impl fmt::Display for Ident {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        f.write_str(&self.to_string())
+    fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        unimplemented!()
     }
 }
 
@@ -1014,8 +1014,8 @@ impl FromStr for Literal {
 /// Prints the literal as a string that should be losslessly convertible
 /// back into the same literal (except for possible rounding for floating point literals).
 impl fmt::Display for Literal {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        f.write_str(&self.to_string())
+    fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        unimplemented!()
     }
 }
 
diff --git a/crates/proc-macro-srv/src/abis/abi_1_63/proc_macro/mod.rs b/crates/proc-macro-srv/src/abis/abi_1_63/proc_macro/mod.rs
index 7ab1f421daf..89bd10da5e4 100644
--- a/crates/proc-macro-srv/src/abis/abi_1_63/proc_macro/mod.rs
+++ b/crates/proc-macro-srv/src/abis/abi_1_63/proc_macro/mod.rs
@@ -124,8 +124,8 @@ impl FromStr for TokenStream {
 /// into the same token stream (modulo spans), except for possibly `TokenTree::Group`s
 /// with `Delimiter::None` delimiters and negative numeric literals.
 impl fmt::Display for TokenStream {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        f.write_str(&self.to_string())
+    fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        unimplemented!()
     }
 }
 
@@ -572,8 +572,8 @@ impl From<Literal> for TokenTree {
 /// into the same token tree (modulo spans), except for possibly `TokenTree::Group`s
 /// with `Delimiter::None` delimiters and negative numeric literals.
 impl fmt::Display for TokenTree {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        f.write_str(&self.to_string())
+    fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        unimplemented!()
     }
 }
 
@@ -669,8 +669,8 @@ impl Group {
 /// into the same group (modulo spans), except for possibly `TokenTree::Group`s
 /// with `Delimiter::None` delimiters.
 impl fmt::Display for Group {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        f.write_str(&self.to_string())
+    fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        unimplemented!()
     }
 }
 
@@ -743,8 +743,8 @@ impl Punct {
 /// Prints the punctuation character as a string that should be losslessly convertible
 /// back into the same character.
 impl fmt::Display for Punct {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        f.write_str(&self.to_string())
+    fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        unimplemented!()
     }
 }
 
@@ -821,8 +821,8 @@ impl Ident {
 /// Prints the identifier as a string that should be losslessly convertible
 /// back into the same identifier.
 impl fmt::Display for Ident {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        f.write_str(&self.to_string())
+    fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        unimplemented!()
     }
 }
 
@@ -1064,8 +1064,8 @@ impl FromStr for Literal {
 /// Prints the literal as a string that should be losslessly convertible
 /// back into the same literal (except for possible rounding for floating point literals).
 impl fmt::Display for Literal {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        f.write_str(&self.to_string())
+    fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        unimplemented!()
     }
 }