about summary refs log tree commit diff
path: root/library/proc_macro/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-02-11 08:25:42 +0100
committerGitHub <noreply@github.com>2024-02-11 08:25:42 +0100
commit0c5d8d3d3eba124329f9a3d11f1459488e117708 (patch)
treeba180d3e882df1fd1f7cef0d30b9d2c8bf9dadc4 /library/proc_macro/src
parenta576e81b1d852b10eb452b40096e7b28ab575b1f (diff)
parente55716e20ec6281c0d6b413062685b71be8b184d (diff)
downloadrust-0c5d8d3d3eba124329f9a3d11f1459488e117708.tar.gz
rust-0c5d8d3d3eba124329f9a3d11f1459488e117708.zip
Rollup merge of #119449 - Nilstrieb:library-clippy, r=cuviper
Fix `clippy::correctness` in the library

needs https://github.com/rust-lang/backtrace-rs/pull/579 to be complete

for https://github.com/rust-lang/compiler-team/issues/709
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 87e89a464bc..90b76cbc26e 100644
--- a/library/proc_macro/src/lib.rs
+++ b/library/proc_macro/src/lib.rs
@@ -201,6 +201,7 @@ impl ToString for TokenStream {
 /// `TokenTree::Punct`, or `TokenTree::Literal`.
 #[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())
     }
@@ -776,6 +777,7 @@ impl ToString for TokenTree {
 /// `TokenTree::Punct`, or `TokenTree::Literal`.
 #[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())
     }
@@ -906,6 +908,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())
     }