about summary refs log tree commit diff
path: root/library/proc_macro/src
diff options
context:
space:
mode:
authorNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2023-12-30 18:10:50 +0100
committerNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2024-01-21 14:14:10 +0100
commite55716e20ec6281c0d6b413062685b71be8b184d (patch)
tree469b3a6bc1bdc8364cef3dec8e6480d334493a1d /library/proc_macro/src
parentd59f06fc64844ec2073e5e888f7470989ef25ff9 (diff)
downloadrust-e55716e20ec6281c0d6b413062685b71be8b184d.tar.gz
rust-e55716e20ec6281c0d6b413062685b71be8b184d.zip
Fix `clippy::correctness` in the library
Diffstat (limited to 'library/proc_macro/src')
-rw-r--r--library/proc_macro/src/bridge/arena.rs1
-rw-r--r--library/proc_macro/src/lib.rs3
2 files changed, 4 insertions, 0 deletions
diff --git a/library/proc_macro/src/bridge/arena.rs b/library/proc_macro/src/bridge/arena.rs
index fa72d2816eb..c2b046ae41e 100644
--- a/library/proc_macro/src/bridge/arena.rs
+++ b/library/proc_macro/src/bridge/arena.rs
@@ -102,6 +102,7 @@ impl Arena {
         }
     }
 
+    #[allow(clippy::mut_from_ref)] // arena allocator
     pub(crate) fn alloc_str<'a>(&'a self, string: &str) -> &'a mut str {
         let alloc = self.alloc_raw(string.len());
         let bytes = MaybeUninit::write_slice(alloc, string.as_bytes());
diff --git a/library/proc_macro/src/lib.rs b/library/proc_macro/src/lib.rs
index 6e664a162df..8ce219931df 100644
--- a/library/proc_macro/src/lib.rs
+++ b/library/proc_macro/src/lib.rs
@@ -192,6 +192,7 @@ impl ToString for TokenStream {
 /// with `Delimiter::None` delimiters and negative numeric literals.
 #[stable(feature = "proc_macro_lib", since = "1.15.0")]
 impl fmt::Display for TokenStream {
+    #[allow(clippy::recursive_format_impl)] // clippy doesn't see the specialization
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.write_str(&self.to_string())
     }
@@ -759,6 +760,7 @@ impl ToString for TokenTree {
 /// with `Delimiter::None` delimiters and negative numeric literals.
 #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
 impl fmt::Display for TokenTree {
+    #[allow(clippy::recursive_format_impl)] // clippy doesn't see the specialization
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.write_str(&self.to_string())
     }
@@ -889,6 +891,7 @@ impl ToString for Group {
 /// with `Delimiter::None` delimiters.
 #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
 impl fmt::Display for Group {
+    #[allow(clippy::recursive_format_impl)] // clippy doesn't see the specialization
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.write_str(&self.to_string())
     }