Fix clippy::correctness
in the library
This commit is contained in:
parent
d59f06fc64
commit
e55716e20e
8 changed files with 16 additions and 0 deletions
|
@ -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());
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue