mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 10:45:18 +00:00
Remove unnecessary sigils around Ident::as_str()
calls.
This commit is contained in:
parent
3bb5f81d8d
commit
122e1c3802
@ -616,10 +616,10 @@ impl<'a> FmtVisitor<'a> {
|
||||
(TyAlias(lty), TyAlias(rty))
|
||||
if both_type(<y.ty, &rty.ty) || both_opaque(<y.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) {
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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!(),
|
||||
|
Loading…
Reference in New Issue
Block a user