Skip to content

fix couple of perf related clippy warnings #68818

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

Merged
merged 1 commit into from
Feb 5, 2020
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
2 changes: 1 addition & 1 deletion src/librustc/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,7 @@ pub trait ToPredicate<'tcx> {
impl<'tcx> ToPredicate<'tcx> for ConstnessAnd<TraitRef<'tcx>> {
fn to_predicate(&self) -> Predicate<'tcx> {
ty::Predicate::Trait(
ty::Binder::dummy(ty::TraitPredicate { trait_ref: self.value.clone() }),
ty::Binder::dummy(ty::TraitPredicate { trait_ref: self.value }),
self.constness,
)
}
Expand Down
3 changes: 1 addition & 2 deletions src/librustc_incremental/persist/file_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ pub fn read_file(
let mut rustc_version_str_len = [0u8; 1];
file.read_exact(&mut rustc_version_str_len)?;
let rustc_version_str_len = rustc_version_str_len[0] as usize;
let mut buffer = Vec::with_capacity(rustc_version_str_len);
buffer.resize(rustc_version_str_len, 0);
let mut buffer = vec![0; rustc_version_str_len];
file.read_exact(&mut buffer)?;

if buffer != rustc_version().as_bytes() {
Expand Down
6 changes: 2 additions & 4 deletions src/librustc_typeck/astconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1438,10 +1438,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {

// Expand trait aliases recursively and check that only one regular (non-auto) trait
// is used and no 'maybe' bounds are used.
let expanded_traits = traits::expand_trait_aliases(
tcx,
bounds.trait_bounds.iter().map(|&(a, b, _)| (a.clone(), b)),
);
let expanded_traits =
traits::expand_trait_aliases(tcx, bounds.trait_bounds.iter().map(|&(a, b, _)| (a, b)));
let (mut auto_traits, regular_traits): (Vec<_>, Vec<_>) =
expanded_traits.partition(|i| tcx.trait_is_auto(i.trait_ref().def_id()));
if regular_traits.len() > 1 {
Expand Down
9 changes: 1 addition & 8 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3629,14 +3629,7 @@ fn render_impl(
for it in &i.inner_impl().items {
if let clean::TypedefItem(ref tydef, _) = it.inner {
write!(w, "<span class=\"where fmt-newline\"> ");
assoc_type(
w,
it,
&vec![],
Some(&tydef.type_),
AssocItemLink::Anchor(None),
"",
);
assoc_type(w, it, &[], Some(&tydef.type_), AssocItemLink::Anchor(None), "");
write!(w, ";</span>");
}
}
Expand Down