inline format!() args from rustc_codegen_llvm to the end (4)
r? @WaffleLapkin
This commit is contained in:
parent
8327047b23
commit
c64ef5e070
94 changed files with 385 additions and 498 deletions
|
@ -1716,7 +1716,7 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns {
|
|||
let end = expr_to_string(&end);
|
||||
let replace = match start {
|
||||
Some(start) => format!("&({}..={})", expr_to_string(&start), end),
|
||||
None => format!("&(..={})", end),
|
||||
None => format!("&(..={end})"),
|
||||
};
|
||||
if join.edition() >= Edition::Edition2021 {
|
||||
cx.sess().emit_err(BuiltinEllipsisInclusiveRangePatterns {
|
||||
|
|
|
@ -411,7 +411,7 @@ impl LintStore {
|
|||
}
|
||||
|
||||
let complete_name = if let Some(tool_name) = tool_name {
|
||||
format!("{}::{}", tool_name, lint_name)
|
||||
format!("{tool_name}::{lint_name}")
|
||||
} else {
|
||||
lint_name.to_string()
|
||||
};
|
||||
|
@ -424,7 +424,7 @@ impl LintStore {
|
|||
// 1. The tool is currently running, so this lint really doesn't exist.
|
||||
// FIXME: should this handle tools that never register a lint, like rustfmt?
|
||||
debug!("lints={:?}", self.by_name.keys().collect::<Vec<_>>());
|
||||
let tool_prefix = format!("{}::", tool_name);
|
||||
let tool_prefix = format!("{tool_name}::");
|
||||
return if self.by_name.keys().any(|lint| lint.starts_with(&tool_prefix)) {
|
||||
self.no_lint_suggestion(&complete_name)
|
||||
} else {
|
||||
|
@ -445,11 +445,11 @@ impl LintStore {
|
|||
}
|
||||
match self.by_name.get(&complete_name) {
|
||||
Some(Renamed(new_name, _)) => CheckLintNameResult::Warning(
|
||||
format!("lint `{}` has been renamed to `{}`", complete_name, new_name),
|
||||
format!("lint `{complete_name}` has been renamed to `{new_name}`"),
|
||||
Some(new_name.to_owned()),
|
||||
),
|
||||
Some(Removed(reason)) => CheckLintNameResult::Warning(
|
||||
format!("lint `{}` has been removed: {}", complete_name, reason),
|
||||
format!("lint `{complete_name}` has been removed: {reason}"),
|
||||
None,
|
||||
),
|
||||
None => match self.lint_groups.get(&*complete_name) {
|
||||
|
@ -503,7 +503,7 @@ impl LintStore {
|
|||
lint_name: &str,
|
||||
tool_name: &str,
|
||||
) -> CheckLintNameResult<'_> {
|
||||
let complete_name = format!("{}::{}", tool_name, lint_name);
|
||||
let complete_name = format!("{tool_name}::{lint_name}");
|
||||
match self.by_name.get(&complete_name) {
|
||||
None => match self.lint_groups.get(&*complete_name) {
|
||||
// Now we are sure, that this lint exists nowhere
|
||||
|
@ -618,12 +618,10 @@ pub trait LintContext: Sized {
|
|||
_ => ("", "s"),
|
||||
};
|
||||
db.span_label(span, format!(
|
||||
"this comment contains {}invisible unicode text flow control codepoint{}",
|
||||
an,
|
||||
s,
|
||||
"this comment contains {an}invisible unicode text flow control codepoint{s}",
|
||||
));
|
||||
for (c, span) in &spans {
|
||||
db.span_label(*span, format!("{:?}", c));
|
||||
db.span_label(*span, format!("{c:?}"));
|
||||
}
|
||||
db.note(
|
||||
"these kind of unicode codepoints change the way text flows on \
|
||||
|
@ -648,7 +646,7 @@ pub trait LintContext: Sized {
|
|||
let opt_colon =
|
||||
if s.trim_start().starts_with("::") { "" } else { "::" };
|
||||
|
||||
(format!("crate{}{}", opt_colon, s), Applicability::MachineApplicable)
|
||||
(format!("crate{opt_colon}{s}"), Applicability::MachineApplicable)
|
||||
}
|
||||
Err(_) => ("crate::<path>".to_string(), Applicability::HasPlaceholders),
|
||||
};
|
||||
|
@ -704,7 +702,7 @@ pub trait LintContext: Sized {
|
|||
let introduced = if is_imported { "imported" } else { "defined" };
|
||||
db.span_label(
|
||||
span,
|
||||
format!("the item `{}` is already {} here", ident, introduced),
|
||||
format!("the item `{ident}` is already {introduced} here"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -908,7 +906,7 @@ pub trait LintContext: Sized {
|
|||
BuiltinLintDiagnostics::NamedArgumentUsedPositionally{ position_sp_to_replace, position_sp_for_msg, named_arg_sp, named_arg_name, is_formatting_arg} => {
|
||||
db.span_label(named_arg_sp, "this named argument is referred to by position in formatting string");
|
||||
if let Some(positional_arg_for_msg) = position_sp_for_msg {
|
||||
let msg = format!("this formatting argument uses named argument `{}` by position", named_arg_name);
|
||||
let msg = format!("this formatting argument uses named argument `{named_arg_name}` by position");
|
||||
db.span_label(positional_arg_for_msg, msg);
|
||||
}
|
||||
|
||||
|
@ -949,11 +947,11 @@ pub trait LintContext: Sized {
|
|||
);
|
||||
}
|
||||
BuiltinLintDiagnostics::AmbiguousGlobReexports { name, namespace, first_reexport_span, duplicate_reexport_span } => {
|
||||
db.span_label(first_reexport_span, format!("the name `{}` in the {} namespace is first re-exported here", name, namespace));
|
||||
db.span_label(duplicate_reexport_span, format!("but the name `{}` in the {} namespace is also re-exported here", name, namespace));
|
||||
db.span_label(first_reexport_span, format!("the name `{name}` in the {namespace} namespace is first re-exported here"));
|
||||
db.span_label(duplicate_reexport_span, format!("but the name `{name}` in the {namespace} namespace is also re-exported here"));
|
||||
}
|
||||
BuiltinLintDiagnostics::HiddenGlobReexports { name, namespace, glob_reexport_span, private_item_span } => {
|
||||
db.span_note(glob_reexport_span, format!("the name `{}` in the {} namespace is supposed to be publicly re-exported here", name, namespace));
|
||||
db.span_note(glob_reexport_span, format!("the name `{name}` in the {namespace} namespace is supposed to be publicly re-exported here"));
|
||||
db.span_note(private_item_span, "but the private item here shadows it".to_owned());
|
||||
}
|
||||
BuiltinLintDiagnostics::UnusedQualifications { removal_span } => {
|
||||
|
@ -1281,8 +1279,8 @@ impl<'tcx> LateContext<'tcx> {
|
|||
// This shouldn't ever be needed, but just in case:
|
||||
with_no_trimmed_paths!({
|
||||
Ok(vec![match trait_ref {
|
||||
Some(trait_ref) => Symbol::intern(&format!("{:?}", trait_ref)),
|
||||
None => Symbol::intern(&format!("<{}>", self_ty)),
|
||||
Some(trait_ref) => Symbol::intern(&format!("{trait_ref:?}")),
|
||||
None => Symbol::intern(&format!("<{self_ty}>")),
|
||||
}])
|
||||
})
|
||||
}
|
||||
|
@ -1306,7 +1304,7 @@ impl<'tcx> LateContext<'tcx> {
|
|||
)))
|
||||
}
|
||||
None => {
|
||||
with_no_trimmed_paths!(Symbol::intern(&format!("<impl {}>", self_ty)))
|
||||
with_no_trimmed_paths!(Symbol::intern(&format!("<impl {self_ty}>")))
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -945,7 +945,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
|
|||
);
|
||||
}
|
||||
} else {
|
||||
panic!("renamed lint does not exist: {}", new_name);
|
||||
panic!("renamed lint does not exist: {new_name}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -776,7 +776,7 @@ impl AddToDiagnostic for HiddenUnicodeCodepointsDiagLabels {
|
|||
) -> rustc_errors::SubdiagnosticMessage,
|
||||
{
|
||||
for (c, span) in self.spans {
|
||||
diag.span_label(span, format!("{:?}", c));
|
||||
diag.span_label(span, format!("{c:?}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -808,7 +808,7 @@ impl AddToDiagnostic for HiddenUnicodeCodepointsDiagSub {
|
|||
spans
|
||||
.into_iter()
|
||||
.map(|(c, span)| {
|
||||
let c = format!("{:?}", c);
|
||||
let c = format!("{c:?}");
|
||||
(span, c[1..c.len() - 1].to_string())
|
||||
})
|
||||
.collect(),
|
||||
|
@ -823,7 +823,7 @@ impl AddToDiagnostic for HiddenUnicodeCodepointsDiagSub {
|
|||
"escaped",
|
||||
spans
|
||||
.into_iter()
|
||||
.map(|(c, _)| format!("{:?}", c))
|
||||
.map(|(c, _)| format!("{c:?}"))
|
||||
.collect::<Vec<String>>()
|
||||
.join(", "),
|
||||
);
|
||||
|
|
|
@ -414,7 +414,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
|
|||
match path {
|
||||
MustUsePath::Suppressed => {}
|
||||
MustUsePath::Boxed(path) => {
|
||||
let descr_pre = &format!("{}boxed ", descr_pre);
|
||||
let descr_pre = &format!("{descr_pre}boxed ");
|
||||
emit_must_use_untranslated(
|
||||
cx,
|
||||
path,
|
||||
|
@ -426,7 +426,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
|
|||
);
|
||||
}
|
||||
MustUsePath::Opaque(path) => {
|
||||
let descr_pre = &format!("{}implementer{} of ", descr_pre, plural_suffix);
|
||||
let descr_pre = &format!("{descr_pre}implementer{plural_suffix} of ");
|
||||
emit_must_use_untranslated(
|
||||
cx,
|
||||
path,
|
||||
|
@ -438,7 +438,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
|
|||
);
|
||||
}
|
||||
MustUsePath::TraitObject(path) => {
|
||||
let descr_post = &format!(" trait object{}{}", plural_suffix, descr_post);
|
||||
let descr_post = &format!(" trait object{plural_suffix}{descr_post}");
|
||||
emit_must_use_untranslated(
|
||||
cx,
|
||||
path,
|
||||
|
@ -451,7 +451,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
|
|||
}
|
||||
MustUsePath::TupleElement(elems) => {
|
||||
for (index, path) in elems {
|
||||
let descr_post = &format!(" in tuple element {}", index);
|
||||
let descr_post = &format!(" in tuple element {index}");
|
||||
emit_must_use_untranslated(
|
||||
cx,
|
||||
path,
|
||||
|
@ -464,7 +464,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
|
|||
}
|
||||
}
|
||||
MustUsePath::Array(path, len) => {
|
||||
let descr_pre = &format!("{}array{} of ", descr_pre, plural_suffix);
|
||||
let descr_pre = &format!("{descr_pre}array{plural_suffix} of ");
|
||||
emit_must_use_untranslated(
|
||||
cx,
|
||||
path,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue