about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2021-12-15 16:13:11 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2021-12-15 17:32:42 +1100
commit122e1c3802afcaa803287b06127c499df63e2dab (patch)
tree8009d2f1dbb56bc40faac06fe959d85bf5d59e7b
parent3bb5f81d8d818ffd506ead1d08996d60e05bba07 (diff)
downloadrust-122e1c3802afcaa803287b06127c499df63e2dab.tar.gz
rust-122e1c3802afcaa803287b06127c499df63e2dab.zip
Remove unnecessary sigils around `Ident::as_str()` calls.
-rw-r--r--src/items.rs6
-rw-r--r--src/modules.rs4
-rw-r--r--src/reorder.rs4
3 files changed, 7 insertions, 7 deletions
diff --git a/src/items.rs b/src/items.rs
index f36bdba26e9..b7dd6b06ff8 100644
--- a/src/items.rs
+++ b/src/items.rs
@@ -616,10 +616,10 @@ impl<'a> FmtVisitor<'a> {
                 (TyAlias(lty), TyAlias(rty))
                     if both_type(&lty.ty, &rty.ty) || both_opaque(&lty.ty, &rty.ty) =>
                 {
-                    a.ident.as_str().cmp(&b.ident.as_str())
+                    a.ident.as_str().cmp(b.ident.as_str())
                 }
                 (Const(..), Const(..)) | (MacCall(..), MacCall(..)) => {
-                    a.ident.as_str().cmp(&b.ident.as_str())
+                    a.ident.as_str().cmp(b.ident.as_str())
                 }
                 (Fn(..), Fn(..)) => a.span.lo().cmp(&b.span.lo()),
                 (TyAlias(ty), _) if is_type(&ty.ty) => Ordering::Less,
@@ -1029,7 +1029,7 @@ pub(crate) fn format_trait(
         if !bounds.is_empty() {
             let ident_hi = context
                 .snippet_provider
-                .span_after(item.span, &item.ident.as_str());
+                .span_after(item.span, item.ident.as_str());
             let bound_hi = bounds.last().unwrap().span().hi();
             let snippet = context.snippet(mk_sp(ident_hi, bound_hi));
             if contains_comment(snippet) {
diff --git a/src/modules.rs b/src/modules.rs
index 6cfe91c597a..9d438a80d94 100644
--- a/src/modules.rs
+++ b/src/modules.rs
@@ -467,10 +467,10 @@ impl<'ast, 'sess, 'c> ModResolver<'ast, 'sess> {
             if let DirectoryOwnership::Owned { relative } = &mut self.directory.ownership {
                 if let Some(ident) = relative.take() {
                     // remove the relative offset
-                    self.directory.path.push(&*ident.as_str());
+                    self.directory.path.push(ident.as_str());
                 }
             }
-            self.directory.path.push(&*id.as_str());
+            self.directory.path.push(id.as_str());
         }
     }
 
diff --git a/src/reorder.rs b/src/reorder.rs
index fe8e5c6b61e..13bfc92507d 100644
--- a/src/reorder.rs
+++ b/src/reorder.rs
@@ -26,7 +26,7 @@ use crate::visitor::FmtVisitor;
 fn compare_items(a: &ast::Item, b: &ast::Item) -> Ordering {
     match (&a.kind, &b.kind) {
         (&ast::ItemKind::Mod(..), &ast::ItemKind::Mod(..)) => {
-            a.ident.as_str().cmp(&b.ident.as_str())
+            a.ident.as_str().cmp(b.ident.as_str())
         }
         (&ast::ItemKind::ExternCrate(ref a_name), &ast::ItemKind::ExternCrate(ref b_name)) => {
             // `extern crate foo as bar;`
@@ -44,7 +44,7 @@ fn compare_items(a: &ast::Item, b: &ast::Item) -> Ordering {
                 (Some(..), None) => Ordering::Greater,
                 (None, Some(..)) => Ordering::Less,
                 (None, None) => Ordering::Equal,
-                (Some(..), Some(..)) => a.ident.as_str().cmp(&b.ident.as_str()),
+                (Some(..), Some(..)) => a.ident.as_str().cmp(b.ident.as_str()),
             }
         }
         _ => unreachable!(),