Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

couple of clippy::perf fixes #96023

Merged
merged 1 commit into from
Apr 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,6 @@ fn build_union_fields_for_direct_tag_generator<'ll, 'tcx>(

// Build the type node for each field.
let variant_field_infos: SmallVec<VariantFieldInfo<'ll>> = variant_range
.clone()
.map(|variant_index| {
let variant_struct_type_di_node = super::build_generator_variant_struct_type_di_node(
cx,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ impl HandlerInner {
(0, 0) => return,
(0, _) => self.emitter.emit_diagnostic(&Diagnostic::new(
Level::Warning,
DiagnosticMessage::Str(warnings.to_owned()),
DiagnosticMessage::Str(warnings),
)),
(_, 0) => {
let _ = self.fatal(&errors);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_expand/src/mbe/macro_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ impl TtParser {
(_, 0) => {
// Dump all possible `next_mps` into `cur_mps` for the next iteration. Then
// process the next token.
self.cur_mps.extend(self.next_mps.drain(..));
self.cur_mps.append(&mut self.next_mps);
parser.to_mut().bump();
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/thir/pattern/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ fn non_exhaustive_match<'p, 'tcx>(
format!(
"{}{}{} => todo!()",
comma,
snippet.strip_prefix(",").unwrap_or(&snippet),
snippet.strip_prefix(',').unwrap_or(&snippet),
pattern
),
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2724,9 +2724,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
&format!(
"consider annotating `{}` with `#[derive({})]`",
trait_pred.skip_binder().self_ty(),
diagnostic_name.to_string(),
diagnostic_name,
),
format!("#[derive({})]\n", diagnostic_name.to_string()),
format!("#[derive({})]\n", diagnostic_name),
Applicability::MaybeIncorrect,
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/passes/html_tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ impl<'a, 'tcx> DocVisitor for InvalidHtmlTagsLinter<'a, 'tcx> {
// We don't try to detect stuff `<like, this>` because that's not valid HTML,
// and we don't try to detect stuff `<like this>` because that's not valid Rust.
if let Some(Some(generics_start)) = (is_open_tag
&& dox[..range.end].ends_with(">"))
&& dox[..range.end].ends_with('>'))
.then(|| extract_path_backwards(&dox, range.start))
{
let generics_sp = match super::source_span_for_markdown_range(
Expand Down