Remove unnecessary sigils around Symbol::as_str()
calls.
This commit is contained in:
parent
8cddcd39ba
commit
056d48a2c9
104 changed files with 189 additions and 192 deletions
|
@ -3183,7 +3183,7 @@ impl<'tcx> LateLintPass<'tcx> for NamedAsmLabels {
|
|||
} = expr
|
||||
{
|
||||
for (template_sym, template_snippet, template_span) in template_strs.iter() {
|
||||
let template_str = &template_sym.as_str();
|
||||
let template_str = template_sym.as_str();
|
||||
let find_label_span = |needle: &str| -> Option<Span> {
|
||||
if let Some(template_snippet) = template_snippet {
|
||||
let snippet = template_snippet.as_str();
|
||||
|
|
|
@ -381,10 +381,10 @@ impl LintStore {
|
|||
lint_name,
|
||||
self.lint_groups.keys().collect::<Vec<_>>()
|
||||
);
|
||||
let lint_name_str = &*lint_name.as_str();
|
||||
self.lint_groups.contains_key(&lint_name_str) || {
|
||||
let lint_name_str = lint_name.as_str();
|
||||
self.lint_groups.contains_key(lint_name_str) || {
|
||||
let warnings_name_str = crate::WARNINGS.name_lower();
|
||||
lint_name_str == &*warnings_name_str
|
||||
lint_name_str == warnings_name_str
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ impl HiddenUnicodeCodepoints {
|
|||
impl EarlyLintPass for HiddenUnicodeCodepoints {
|
||||
fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &ast::Attribute) {
|
||||
if let ast::AttrKind::DocComment(_, comment) = attr.kind {
|
||||
if contains_text_flow_control_chars(&comment.as_str()) {
|
||||
if contains_text_flow_control_chars(comment.as_str()) {
|
||||
self.lint_text_direction_codepoint(cx, comment, attr.span, 0, false, "doc comment");
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ impl EarlyLintPass for HiddenUnicodeCodepoints {
|
|||
let (text, span, padding) = match &expr.kind {
|
||||
ast::ExprKind::Lit(ast::Lit { token, kind, span }) => {
|
||||
let text = token.symbol;
|
||||
if !contains_text_flow_control_chars(&text.as_str()) {
|
||||
if !contains_text_flow_control_chars(text.as_str()) {
|
||||
return;
|
||||
}
|
||||
let padding = match kind {
|
||||
|
|
|
@ -154,7 +154,7 @@ impl<'s> LintLevelsBuilder<'s> {
|
|||
LintLevelSource::Node(_, forbid_source_span, reason) => {
|
||||
diag_builder.span_label(forbid_source_span, "`forbid` level set here");
|
||||
if let Some(rationale) = reason {
|
||||
diag_builder.note(&rationale.as_str());
|
||||
diag_builder.note(rationale.as_str());
|
||||
}
|
||||
}
|
||||
LintLevelSource::CommandLine(_, _) => {
|
||||
|
|
|
@ -218,8 +218,7 @@ impl EarlyLintPass for NonAsciiIdents {
|
|||
cx.struct_span_lint(CONFUSABLE_IDENTS, sp, |lint| {
|
||||
lint.build(&format!(
|
||||
"identifier pair considered confusable between `{}` and `{}`",
|
||||
existing_symbol.as_str(),
|
||||
symbol.as_str()
|
||||
existing_symbol, symbol
|
||||
))
|
||||
.span_label(
|
||||
*existing_span,
|
||||
|
|
|
@ -71,7 +71,7 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
|
|||
if let hir::ExprKind::Lit(lit) = &arg.kind {
|
||||
if let ast::LitKind::Str(sym, _) = lit.node {
|
||||
// The argument is a string literal.
|
||||
check_panic_str(cx, f, arg, &sym.as_str());
|
||||
check_panic_str(cx, f, arg, sym.as_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ fn to_camel_case(s: &str) -> String {
|
|||
|
||||
impl NonCamelCaseTypes {
|
||||
fn check_case(&self, cx: &EarlyContext<'_>, sort: &str, ident: &Ident) {
|
||||
let name = &ident.name.as_str();
|
||||
let name = ident.name.as_str();
|
||||
|
||||
if !is_camel_case(name) {
|
||||
cx.struct_span_lint(NON_CAMEL_CASE_TYPES, ident.span, |lint| {
|
||||
|
@ -276,7 +276,7 @@ impl NonSnakeCase {
|
|||
})
|
||||
}
|
||||
|
||||
let name = &ident.name.as_str();
|
||||
let name = ident.name.as_str();
|
||||
|
||||
if !is_snake_case(name) {
|
||||
cx.struct_span_lint(NON_SNAKE_CASE, ident.span, |lint| {
|
||||
|
@ -484,7 +484,7 @@ declare_lint_pass!(NonUpperCaseGlobals => [NON_UPPER_CASE_GLOBALS]);
|
|||
|
||||
impl NonUpperCaseGlobals {
|
||||
fn check_upper_case(cx: &LateContext<'_>, sort: &str, ident: &Ident) {
|
||||
let name = &ident.name.as_str();
|
||||
let name = ident.name.as_str();
|
||||
if name.chars().any(|c| c.is_lowercase()) {
|
||||
cx.struct_span_lint(NON_UPPER_CASE_GLOBALS, ident.span, |lint| {
|
||||
let uc = NonSnakeCase::to_snake_case(&name).to_uppercase();
|
||||
|
|
|
@ -313,7 +313,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
|
|||
let mut err = lint.build(&msg);
|
||||
// check for #[must_use = "..."]
|
||||
if let Some(note) = attr.value_str() {
|
||||
err.note(¬e.as_str());
|
||||
err.note(note.as_str());
|
||||
}
|
||||
err.emit();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue