Skip to content

Commit

Permalink
Auto merge of #4972 - JohnTitor:rustup, r=llogiq
Browse files Browse the repository at this point in the history
Rustup to rust-lang/rust#66942

changelog: none
  • Loading branch information
bors committed Dec 30, 2019
2 parents c807fbc + 790012a commit 5b25588
Show file tree
Hide file tree
Showing 37 changed files with 141 additions and 131 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/booleans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonminimalBool {
&mut self,
cx: &LateContext<'a, 'tcx>,
_: intravisit::FnKind<'tcx>,
_: &'tcx FnDecl,
_: &'tcx FnDecl<'_>,
body: &'tcx Body<'_>,
_: Span,
_: HirId,
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/checked_conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ fn get_types_from_cast<'a>(expr: &'a Expr<'_>, func: &'a str, types: &'a [&str])
}

/// Gets the type which implements the called function
fn get_implementing_type<'a>(path: &QPath, candidates: &'a [&str], function: &str) -> Option<&'a str> {
fn get_implementing_type<'a>(path: &QPath<'_>, candidates: &'a [&str], function: &str) -> Option<&'a str> {
if_chain! {
if let QPath::TypeRelative(ref ty, ref path) = &path;
if path.ident.name.as_str() == function;
Expand All @@ -304,7 +304,7 @@ fn get_implementing_type<'a>(path: &QPath, candidates: &'a [&str], function: &st
}

/// Gets the type as a string, if it is a supported integer
fn int_ty_to_sym(path: &QPath) -> Option<&str> {
fn int_ty_to_sym<'tcx>(path: &QPath<'_>) -> Option<&'tcx str> {
if_chain! {
if let QPath::Resolved(_, ref path) = *path;
if let [ty] = &*path.segments;
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/cognitive_complexity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl CognitiveComplexity {
&mut self,
cx: &'a LateContext<'a, 'tcx>,
kind: FnKind<'tcx>,
decl: &'tcx FnDecl,
decl: &'tcx FnDecl<'_>,
body: &'tcx Body<'_>,
body_span: Span,
) {
Expand Down Expand Up @@ -116,7 +116,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CognitiveComplexity {
&mut self,
cx: &LateContext<'a, 'tcx>,
kind: FnKind<'tcx>,
decl: &'tcx FnDecl,
decl: &'tcx FnDecl<'_>,
body: &'tcx Body<'_>,
span: Span,
hir_id: HirId,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
}

/// Lookup a possibly constant expression from a `ExprKind::Path`.
fn fetch_path(&mut self, qpath: &QPath, id: HirId) -> Option<Constant> {
fn fetch_path(&mut self, qpath: &QPath<'_>, id: HirId) -> Option<Constant> {
let res = self.tables.qpath_res(qpath, id);
match res {
Res::Def(DefKind::Const, def_id) | Res::Def(DefKind::AssocConst, def_id) => {
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Derive {
fn check_hash_peq<'a, 'tcx>(
cx: &LateContext<'a, 'tcx>,
span: Span,
trait_ref: &TraitRef,
trait_ref: &TraitRef<'_>,
ty: Ty<'tcx>,
hash_is_automatically_derived: bool,
) {
Expand Down Expand Up @@ -130,7 +130,7 @@ fn check_hash_peq<'a, 'tcx>(
}

/// Implementation of the `EXPL_IMPL_CLONE_ON_COPY` lint.
fn check_copy_clone<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, item: &Item<'_>, trait_ref: &TraitRef, ty: Ty<'tcx>) {
fn check_copy_clone<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, item: &Item<'_>, trait_ref: &TraitRef<'_>, ty: Ty<'tcx>) {
if match_path(&trait_ref.path, &paths::CLONE_TRAIT) {
if !is_copy(cx, ty) {
return;
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ fn lint_for_missing_headers<'a, 'tcx>(
cx: &LateContext<'a, 'tcx>,
hir_id: hir::HirId,
span: impl Into<MultiSpan> + Copy,
sig: &hir::FnSig,
sig: &hir::FnSig<'_>,
headers: DocHeaders,
) {
if !cx.access_levels.is_exported(hir_id) {
Expand Down
10 changes: 5 additions & 5 deletions clippy_lints/src/drop_bounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@ const DROP_BOUNDS_SUMMARY: &str = "Bounds of the form `T: Drop` are useless. \
declare_lint_pass!(DropBounds => [DROP_BOUNDS]);

impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DropBounds {
fn check_generic_param(&mut self, cx: &rustc::lint::LateContext<'a, 'tcx>, p: &'tcx GenericParam) {
for bound in &p.bounds {
fn check_generic_param(&mut self, cx: &rustc::lint::LateContext<'a, 'tcx>, p: &'tcx GenericParam<'_>) {
for bound in p.bounds.iter() {
lint_bound(cx, bound);
}
}
fn check_where_predicate(&mut self, cx: &rustc::lint::LateContext<'a, 'tcx>, p: &'tcx WherePredicate) {
fn check_where_predicate(&mut self, cx: &rustc::lint::LateContext<'a, 'tcx>, p: &'tcx WherePredicate<'_>) {
if let WherePredicate::BoundPredicate(WhereBoundPredicate { bounds, .. }) = p {
for bound in bounds {
for bound in *bounds {
lint_bound(cx, bound);
}
}
}
}

fn lint_bound<'a, 'tcx>(cx: &rustc::lint::LateContext<'a, 'tcx>, bound: &'tcx GenericBound) {
fn lint_bound<'a, 'tcx>(cx: &rustc::lint::LateContext<'a, 'tcx>, bound: &'tcx GenericBound<'_>) {
if_chain! {
if let GenericBound::Trait(t, _) = bound;
if let Some(def_id) = t.trait_ref.path.res.opt_def_id();
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/escape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxedLocal {
&mut self,
cx: &LateContext<'a, 'tcx>,
_: visit::FnKind<'tcx>,
_: &'tcx FnDecl,
_: &'tcx FnDecl<'_>,
body: &'tcx Body<'_>,
_: Span,
hir_id: HirId,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/fallible_impl_from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for FallibleImplFrom {
}
}

fn lint_impl_body<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, impl_span: Span, impl_items: &[hir::ImplItemRef]) {
fn lint_impl_body<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, impl_span: Span, impl_items: &[hir::ImplItemRef<'_>]) {
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc::hir::*;

Expand Down
14 changes: 7 additions & 7 deletions clippy_lints/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
&mut self,
cx: &LateContext<'a, 'tcx>,
kind: intravisit::FnKind<'tcx>,
decl: &'tcx hir::FnDecl,
decl: &'tcx hir::FnDecl<'_>,
body: &'tcx hir::Body<'_>,
span: Span,
hir_id: hir::HirId,
Expand Down Expand Up @@ -306,7 +306,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
}

impl<'a, 'tcx> Functions {
fn check_arg_number(self, cx: &LateContext<'_, '_>, decl: &hir::FnDecl, fn_span: Span) {
fn check_arg_number(self, cx: &LateContext<'_, '_>, decl: &hir::FnDecl<'_>, fn_span: Span) {
let args = decl.inputs.len() as u64;
if args > self.threshold {
span_lint(
Expand Down Expand Up @@ -375,7 +375,7 @@ impl<'a, 'tcx> Functions {
fn check_raw_ptr(
cx: &LateContext<'a, 'tcx>,
unsafety: hir::Unsafety,
decl: &'tcx hir::FnDecl,
decl: &'tcx hir::FnDecl<'_>,
body: &'tcx hir::Body<'_>,
hir_id: hir::HirId,
) {
Expand All @@ -402,7 +402,7 @@ impl<'a, 'tcx> Functions {

fn check_needless_must_use(
cx: &LateContext<'_, '_>,
decl: &hir::FnDecl,
decl: &hir::FnDecl<'_>,
item_id: hir::HirId,
item_span: Span,
fn_header_span: Span,
Expand Down Expand Up @@ -439,7 +439,7 @@ fn check_needless_must_use(

fn check_must_use_candidate<'a, 'tcx>(
cx: &LateContext<'a, 'tcx>,
decl: &'tcx hir::FnDecl,
decl: &'tcx hir::FnDecl<'_>,
body: &'tcx hir::Body<'_>,
item_span: Span,
item_id: hir::HirId,
Expand Down Expand Up @@ -467,7 +467,7 @@ fn check_must_use_candidate<'a, 'tcx>(
});
}

fn returns_unit(decl: &hir::FnDecl) -> bool {
fn returns_unit(decl: &hir::FnDecl<'_>) -> bool {
match decl.output {
hir::FunctionRetTy::DefaultReturn(_) => true,
hir::FunctionRetTy::Return(ref ty) => match ty.kind {
Expand Down Expand Up @@ -518,7 +518,7 @@ fn is_mutable_ty<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx>, span: Span,
}
}

fn raw_ptr_arg(arg: &hir::Param<'_>, ty: &hir::Ty) -> Option<hir::HirId> {
fn raw_ptr_arg(arg: &hir::Param<'_>, ty: &hir::Ty<'_>) -> Option<hir::HirId> {
if let (&hir::PatKind::Binding(_, id, _, _), &hir::TyKind::Ptr(_)) = (&arg.pat.kind, &ty.kind) {
Some(id)
} else {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/implicit_return.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImplicitReturn {
&mut self,
cx: &LateContext<'a, 'tcx>,
_: FnKind<'tcx>,
_: &'tcx FnDecl,
_: &'tcx FnDecl<'_>,
body: &'tcx Body<'_>,
span: Span,
_: HirId,
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/len_zero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ fn check_trait_items(cx: &LateContext<'_, '_>, visited_trait: &Item<'_>, trait_i
}
}

fn check_impl_items(cx: &LateContext<'_, '_>, item: &Item<'_>, impl_items: &[ImplItemRef]) {
fn is_named_self(cx: &LateContext<'_, '_>, item: &ImplItemRef, name: &str) -> bool {
fn check_impl_items(cx: &LateContext<'_, '_>, item: &Item<'_>, impl_items: &[ImplItemRef<'_>]) {
fn is_named_self(cx: &LateContext<'_, '_>, item: &ImplItemRef<'_>, name: &str) -> bool {
item.ident.name.as_str() == name
&& if let AssocItemKind::Method { has_self } = item.kind {
has_self && {
Expand Down
30 changes: 15 additions & 15 deletions clippy_lints/src/lifetimes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ enum RefLt {

fn check_fn_inner<'a, 'tcx>(
cx: &LateContext<'a, 'tcx>,
decl: &'tcx FnDecl,
decl: &'tcx FnDecl<'_>,
body: Option<BodyId>,
generics: &'tcx Generics,
generics: &'tcx Generics<'_>,
span: Span,
report_extra_lifetimes: bool,
) {
Expand All @@ -128,7 +128,7 @@ fn check_fn_inner<'a, 'tcx>(
_ => false,
});
for typ in types {
for bound in &typ.bounds {
for bound in typ.bounds {
let mut visitor = RefVisitor::new(cx);
walk_param_bound(&mut visitor, bound);
if visitor.lts.iter().any(|lt| matches!(lt, RefLt::Named(_))) {
Expand Down Expand Up @@ -173,9 +173,9 @@ fn check_fn_inner<'a, 'tcx>(

fn could_use_elision<'a, 'tcx>(
cx: &LateContext<'a, 'tcx>,
func: &'tcx FnDecl,
func: &'tcx FnDecl<'_>,
body: Option<BodyId>,
named_generics: &'tcx [GenericParam],
named_generics: &'tcx [GenericParam<'_>],
bounds_lts: Vec<&'tcx Lifetime>,
) -> bool {
// There are two scenarios where elision works:
Expand All @@ -192,7 +192,7 @@ fn could_use_elision<'a, 'tcx>(
let mut output_visitor = RefVisitor::new(cx);

// extract lifetimes in input argument types
for arg in &func.inputs {
for arg in func.inputs {
input_visitor.visit_ty(arg);
}
// extract lifetimes in output type
Expand Down Expand Up @@ -258,7 +258,7 @@ fn could_use_elision<'a, 'tcx>(
}
}

fn allowed_lts_from(named_generics: &[GenericParam]) -> FxHashSet<RefLt> {
fn allowed_lts_from(named_generics: &[GenericParam<'_>]) -> FxHashSet<RefLt> {
let mut allowed_lts = FxHashSet::default();
for par in named_generics.iter() {
if let GenericParamKind::Lifetime { .. } = par.kind {
Expand Down Expand Up @@ -328,7 +328,7 @@ impl<'v, 't> RefVisitor<'v, 't> {
}
}

fn collect_anonymous_lifetimes(&mut self, qpath: &QPath, ty: &Ty) {
fn collect_anonymous_lifetimes(&mut self, qpath: &QPath<'_>, ty: &Ty<'_>) {
if let Some(ref last_path_segment) = last_path_segment(qpath).args {
if !last_path_segment.parenthesized
&& !last_path_segment.args.iter().any(|arg| match arg {
Expand Down Expand Up @@ -363,7 +363,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RefVisitor<'a, 'tcx> {
self.record(&Some(*lifetime));
}

fn visit_ty(&mut self, ty: &'tcx Ty) {
fn visit_ty(&mut self, ty: &'tcx Ty<'_>) {
match ty.kind {
TyKind::Rptr(ref lt, _) if lt.is_elided() => {
self.record(&None);
Expand All @@ -374,7 +374,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RefVisitor<'a, 'tcx> {
TyKind::Def(item, _) => {
let map = self.cx.tcx.hir();
if let ItemKind::OpaqueTy(ref exist_ty) = map.expect_item(item.id).kind {
for bound in &exist_ty.bounds {
for bound in exist_ty.bounds {
if let GenericBound::Outlives(_) = *bound {
self.record(&None);
}
Expand All @@ -384,7 +384,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RefVisitor<'a, 'tcx> {
}
walk_ty(self, ty);
},
TyKind::TraitObject(ref bounds, ref lt) => {
TyKind::TraitObject(bounds, ref lt) => {
if !lt.is_elided() {
self.abort = true;
}
Expand All @@ -404,8 +404,8 @@ impl<'a, 'tcx> Visitor<'tcx> for RefVisitor<'a, 'tcx> {

/// Are any lifetimes mentioned in the `where` clause? If so, we don't try to
/// reason about elision.
fn has_where_lifetimes<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, where_clause: &'tcx WhereClause) -> bool {
for predicate in &where_clause.predicates {
fn has_where_lifetimes<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, where_clause: &'tcx WhereClause<'_>) -> bool {
for predicate in where_clause.predicates {
match *predicate {
WherePredicate::RegionPredicate(..) => return true,
WherePredicate::BoundPredicate(ref pred) => {
Expand Down Expand Up @@ -457,7 +457,7 @@ impl<'tcx> Visitor<'tcx> for LifetimeChecker {
self.map.remove(&lifetime.name.ident().name);
}

fn visit_generic_param(&mut self, param: &'tcx GenericParam) {
fn visit_generic_param(&mut self, param: &'tcx GenericParam<'_>) {
// don't actually visit `<'a>` or `<'a: 'b>`
// we've already visited the `'a` declarations and
// don't want to spuriously remove them
Expand All @@ -472,7 +472,7 @@ impl<'tcx> Visitor<'tcx> for LifetimeChecker {
}
}

fn report_extra_lifetimes<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, func: &'tcx FnDecl, generics: &'tcx Generics) {
fn report_extra_lifetimes<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, func: &'tcx FnDecl<'_>, generics: &'tcx Generics<'_>) {
let hs = generics
.params
.iter()
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/methods/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3109,8 +3109,8 @@ enum OutType {
}

impl OutType {
fn matches(self, cx: &LateContext<'_, '_>, ty: &hir::FunctionRetTy) -> bool {
let is_unit = |ty: &hir::Ty| SpanlessEq::new(cx).eq_ty_kind(&ty.kind, &hir::TyKind::Tup(vec![].into()));
fn matches(self, cx: &LateContext<'_, '_>, ty: &hir::FunctionRetTy<'_>) -> bool {
let is_unit = |ty: &hir::Ty<'_>| SpanlessEq::new(cx).eq_ty_kind(&ty.kind, &hir::TyKind::Tup(&[]));
match (self, ty) {
(Self::Unit, &hir::DefaultReturn(_)) => true,
(Self::Unit, &hir::Return(ref ty)) if is_unit(ty) => true,
Expand All @@ -3122,7 +3122,7 @@ impl OutType {
}
}

fn is_bool(ty: &hir::Ty) -> bool {
fn is_bool(ty: &hir::Ty<'_>) -> bool {
if let hir::TyKind::Path(ref p) = ty.kind {
match_qpath(p, &["bool"])
} else {
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/methods/option_map_unwrap_or.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ struct UnwrapVisitor<'a, 'tcx> {
}

impl<'a, 'tcx> Visitor<'tcx> for UnwrapVisitor<'a, 'tcx> {
fn visit_path(&mut self, path: &'tcx Path, _id: HirId) {
fn visit_path(&mut self, path: &'tcx Path<'_>, _id: HirId) {
self.identifiers.insert(ident(path));
walk_path(self, path);
}
Expand All @@ -100,7 +100,7 @@ struct MapExprVisitor<'a, 'tcx> {
}

impl<'a, 'tcx> Visitor<'tcx> for MapExprVisitor<'a, 'tcx> {
fn visit_path(&mut self, path: &'tcx Path, _id: HirId) {
fn visit_path(&mut self, path: &'tcx Path<'_>, _id: HirId) {
if self.identifiers.contains(&ident(path)) {
self.found_identifier = true;
return;
Expand All @@ -113,7 +113,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MapExprVisitor<'a, 'tcx> {
}
}

fn ident(path: &Path) -> Symbol {
fn ident(path: &Path<'_>) -> Symbol {
path.segments
.last()
.expect("segments should be composed of at least 1 element")
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MiscLints {
&mut self,
cx: &LateContext<'a, 'tcx>,
k: FnKind<'tcx>,
decl: &'tcx FnDecl,
decl: &'tcx FnDecl<'_>,
body: &'tcx Body<'_>,
_: Span,
_: HirId,
Expand Down Expand Up @@ -626,7 +626,7 @@ fn non_macro_local(cx: &LateContext<'_, '_>, res: def::Res) -> bool {
}
}

fn check_cast(cx: &LateContext<'_, '_>, span: Span, e: &Expr<'_>, ty: &Ty) {
fn check_cast(cx: &LateContext<'_, '_>, span: Span, e: &Expr<'_>, ty: &Ty<'_>) {
if_chain! {
if let TyKind::Ptr(ref mut_ty) = ty.kind;
if let ExprKind::Lit(ref lit) = e.kind;
Expand Down
Loading

0 comments on commit 5b25588

Please sign in to comment.