clippy::{redundant_pattern_matching, clone_on_copy, iter_cloned_collect, option_as_ref_deref, match_ref_pats}
impl<'r, 'a, T: Ord> Drop for DropGuard<'r, 'a, T> {
fn drop(&mut self) {
- while let Some(_) = self.0.inner.pop() {}
+ while self.0.inner.pop().is_some() {}
}
}
fn drop(&mut self) {
// Continue the same loop we do below. This only runs when a destructor has
// panicked. If another one panics this will abort.
- while let Some(_) = self.0.pop_front_node() {}
+ while self.0.pop_front_node().is_some() {}
}
}
) -> Compilation {
let r = matches.opt_strs("Z");
if r.iter().any(|s| *s == "ls") {
- match input {
- &Input::File(ref ifile) => {
+ match *input {
+ Input::File(ref ifile) => {
let path = &(*ifile);
let mut v = Vec::new();
locator::list_file_metadata(&sess.target.target, path, metadata_loader, &mut v)
.unwrap();
println!("{}", String::from_utf8(v).unwrap());
}
- &Input::Str { .. } => {
+ Input::Str { .. } => {
early_error(ErrorOutputType::default(), "cannot list metadata for stdin");
}
}
| ast::TyKind::Rptr(_, ast::MutTy { ty: ref subty, .. })
| ast::TyKind::Paren(ref subty) => involves_impl_trait(subty),
ast::TyKind::Tup(ref tys) => any_involves_impl_trait(tys.iter()),
- ast::TyKind::Path(_, ref path) => path.segments.iter().any(|seg| {
- match seg.args.as_ref().map(|generic_arg| &**generic_arg) {
+ ast::TyKind::Path(_, ref path) => {
+ path.segments.iter().any(|seg| match seg.args.as_deref() {
None => false,
Some(&ast::GenericArgs::AngleBracketed(ref data)) => {
data.args.iter().any(|arg| match arg {
any_involves_impl_trait(data.inputs.iter())
|| ReplaceBodyWithLoop::should_ignore_fn(&data.output)
}
- }
- }),
+ })
+ }
_ => false,
}
}
ident,
id: ast::DUMMY_NODE_ID,
span,
- attrs: attrs.iter().cloned().collect(),
+ attrs: attrs.to_vec(),
kind: ast::ItemKind::MacroDef(data.get_macro(id.index, sess)),
vis: source_map::respan(span.shrink_to_lo(), ast::VisibilityKind::Inherited),
tokens: None,
}
fn constant(src_constant: &Constant<'tcx>) -> Option<Action<'tcx>> {
- Some(Action::PropagateConstant((*src_constant).clone()))
+ Some(Action::PropagateConstant(*src_constant))
}
fn perform(
_ => return,
}
- *operand = Operand::Constant(box self.constant.clone());
+ *operand = Operand::Constant(box self.constant);
self.uses_replaced += 1
}
}
let of_fld = Field::new(1);
let tcx = self.hir.tcx();
- let val = tcx.mk_place_field(result_value.clone(), val_fld, ty);
+ let val = tcx.mk_place_field(result_value, val_fld, ty);
let of = tcx.mk_place_field(result_value, of_fld, bool_ty);
let err = AssertKind::Overflow(op);
);
cnt != DISCONNECTED && cnt != steals
} {
- while let Some(_) = self.queue.pop() {
+ while self.queue.pop().is_some() {
steals += 1;
}
}