Fix dogfood
This commit is contained in:
parent
e3c60444ce
commit
01e302b2f7
@ -190,7 +190,7 @@ fn unit_closure<'tcx>(
|
||||
/// Anything else will return `a`.
|
||||
fn let_binding_name(cx: &LateContext<'_>, var_arg: &hir::Expr<'_>) -> String {
|
||||
match &var_arg.kind {
|
||||
hir::ExprKind::Field(_, _) => snippet(cx, var_arg.span, "_").replace(".", "_"),
|
||||
hir::ExprKind::Field(_, _) => snippet(cx, var_arg.span, "_").replace('.', "_"),
|
||||
hir::ExprKind::Path(_) => format!("_{}", snippet(cx, var_arg.span, "")),
|
||||
_ => "a".to_string(),
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ fn is_offending_macro<'a>(cx: &EarlyContext<'_>, span: Span, mac_braces: &'a Mac
|
||||
if snip.starts_with(&format!("{}!", name));
|
||||
if unnested_or_local();
|
||||
// make formatting consistent
|
||||
let c = snip.replace(" ", "");
|
||||
let c = snip.replace(' ', "");
|
||||
if !c.starts_with(&format!("{}!{}", name, braces.0));
|
||||
if !mac_braces.done.contains(&span.ctxt().outer_expn_data().call_site);
|
||||
then {
|
||||
|
@ -76,7 +76,7 @@ impl<'tcx> LateLintPass<'tcx> for SelfNamedConstructors {
|
||||
let self_id = cx.tcx.hir().local_def_id_to_hir_id(self_local_did);
|
||||
if let Some(Node::Item(x)) = cx.tcx.hir().find(self_id);
|
||||
let type_name = x.ident.name.as_str().to_lowercase();
|
||||
if impl_item.ident.name.as_str() == type_name || impl_item.ident.name.as_str().replace("_", "") == type_name;
|
||||
if impl_item.ident.name.as_str() == type_name || impl_item.ident.name.as_str().replace('_', "") == type_name;
|
||||
|
||||
then {
|
||||
span_lint(
|
||||
|
@ -106,9 +106,9 @@ fn check_str(cx: &LateContext<'_>, span: Span, id: HirId) {
|
||||
"invisible character detected",
|
||||
"consider replacing the string with",
|
||||
string
|
||||
.replace("\u{200B}", "\\u{200B}")
|
||||
.replace("\u{ad}", "\\u{AD}")
|
||||
.replace("\u{2060}", "\\u{2060}"),
|
||||
.replace('\u{200B}', "\\u{200B}")
|
||||
.replace('\u{ad}', "\\u{AD}")
|
||||
.replace('\u{2060}', "\\u{2060}"),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
|
@ -583,10 +583,10 @@ impl Write {
|
||||
let replacement: String = match lit.token.kind {
|
||||
LitKind::Integer | LitKind::Float | LitKind::Err => continue,
|
||||
LitKind::StrRaw(_) | LitKind::ByteStrRaw(_) if matches!(fmtstr.style, StrStyle::Raw(_)) => {
|
||||
lit.token.symbol.as_str().replace("{", "{{").replace("}", "}}")
|
||||
lit.token.symbol.as_str().replace('{', "{{").replace('}', "}}")
|
||||
},
|
||||
LitKind::Str | LitKind::ByteStr if matches!(fmtstr.style, StrStyle::Cooked) => {
|
||||
lit.token.symbol.as_str().replace("{", "{{").replace("}", "}}")
|
||||
lit.token.symbol.as_str().replace('{', "{{").replace('}', "}}")
|
||||
},
|
||||
LitKind::StrRaw(_) | LitKind::Str | LitKind::ByteStrRaw(_) | LitKind::ByteStr => continue,
|
||||
LitKind::Byte | LitKind::Char => match &*lit.token.symbol.as_str() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user