diff --git a/clippy_lints/src/functions.rs b/clippy_lints/src/functions.rs index ee9221c811e8..ce0bfea5160e 100644 --- a/clippy_lints/src/functions.rs +++ b/clippy_lints/src/functions.rs @@ -468,8 +468,8 @@ fn check_must_use_candidate<'a, 'tcx>( fn returns_unit(decl: &hir::FnDecl<'_>) -> bool { match decl.output { - hir::FunctionRetTy::DefaultReturn(_) => true, - hir::FunctionRetTy::Return(ref ty) => match ty.kind { + hir::FnRetTy::DefaultReturn(_) => true, + hir::FnRetTy::Return(ref ty) => match ty.kind { hir::TyKind::Tup(ref tys) => tys.is_empty(), hir::TyKind::Never => true, _ => false, diff --git a/clippy_lints/src/lifetimes.rs b/clippy_lints/src/lifetimes.rs index 13484ba0fa76..f98021bca459 100644 --- a/clippy_lints/src/lifetimes.rs +++ b/clippy_lints/src/lifetimes.rs @@ -4,7 +4,7 @@ use rustc::lint::in_external_macro; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir::def::{DefKind, Res}; use rustc_hir::intravisit::*; -use rustc_hir::FunctionRetTy::Return; +use rustc_hir::FnRetTy::Return; use rustc_hir::*; use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs index d84948654771..00a9fd894647 100644 --- a/clippy_lints/src/methods/mod.rs +++ b/clippy_lints/src/methods/mod.rs @@ -3406,14 +3406,14 @@ enum OutType { } impl OutType { - fn matches(self, cx: &LateContext<'_, '_>, ty: &hir::FunctionRetTy<'_>) -> bool { + fn matches(self, cx: &LateContext<'_, '_>, ty: &hir::FnRetTy<'_>) -> bool { let is_unit = |ty: &hir::Ty<'_>| SpanlessEq::new(cx).eq_ty_kind(&ty.kind, &hir::TyKind::Tup(&[])); match (self, ty) { - (Self::Unit, &hir::FunctionRetTy::DefaultReturn(_)) => true, - (Self::Unit, &hir::FunctionRetTy::Return(ref ty)) if is_unit(ty) => true, - (Self::Bool, &hir::FunctionRetTy::Return(ref ty)) if is_bool(ty) => true, - (Self::Any, &hir::FunctionRetTy::Return(ref ty)) if !is_unit(ty) => true, - (Self::Ref, &hir::FunctionRetTy::Return(ref ty)) => matches!(ty.kind, hir::TyKind::Rptr(_, _)), + (Self::Unit, &hir::FnRetTy::DefaultReturn(_)) => true, + (Self::Unit, &hir::FnRetTy::Return(ref ty)) if is_unit(ty) => true, + (Self::Bool, &hir::FnRetTy::Return(ref ty)) if is_bool(ty) => true, + (Self::Any, &hir::FnRetTy::Return(ref ty)) if !is_unit(ty) => true, + (Self::Ref, &hir::FnRetTy::Return(ref ty)) => matches!(ty.kind, hir::TyKind::Rptr(_, _)), _ => false, } } diff --git a/clippy_lints/src/ptr.rs b/clippy_lints/src/ptr.rs index 445f065aaced..33cfa5d75c62 100644 --- a/clippy_lints/src/ptr.rs +++ b/clippy_lints/src/ptr.rs @@ -253,7 +253,7 @@ fn check_fn(cx: &LateContext<'_, '_>, decl: &FnDecl<'_>, fn_id: HirId, opt_body_ } } - if let FunctionRetTy::Return(ref ty) = decl.output { + if let FnRetTy::Return(ref ty) = decl.output { if let Some((out, Mutability::Mut, _)) = get_rptr_lm(ty) { let mut immutables = vec![]; for (_, ref mutbl, ref argspan) in decl diff --git a/clippy_lints/src/returns.rs b/clippy_lints/src/returns.rs index 6bf373a9a626..fc371dccd732 100644 --- a/clippy_lints/src/returns.rs +++ b/clippy_lints/src/returns.rs @@ -242,7 +242,7 @@ impl EarlyLintPass for Return { FnKind::Fn(.., None) => {}, } if_chain! { - if let ast::FunctionRetTy::Ty(ref ty) = kind.decl().output; + if let ast::FnRetTy::Ty(ref ty) = kind.decl().output; if let ast::TyKind::Tup(ref vals) = ty.kind; if vals.is_empty() && !ty.span.from_expansion() && get_def(span) == get_def(ty.span); then { diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs index e47f2480a541..d23487b5b334 100644 --- a/clippy_lints/src/types.rs +++ b/clippy_lints/src/types.rs @@ -242,7 +242,7 @@ impl Types { self.check_ty(cx, input, false); } - if let FunctionRetTy::Return(ref ty) = decl.output { + if let FnRetTy::Return(ref ty) = decl.output { self.check_ty(cx, ty, false); } } @@ -1476,7 +1476,7 @@ impl<'a, 'tcx> TypeComplexity { for arg in decl.inputs { self.check_type(cx, arg); } - if let FunctionRetTy::Return(ref ty) = decl.output { + if let FnRetTy::Return(ref ty) = decl.output { self.check_type(cx, ty); } } diff --git a/clippy_lints/src/use_self.rs b/clippy_lints/src/use_self.rs index 9be070bd3d15..da961a5f89da 100644 --- a/clippy_lints/src/use_self.rs +++ b/clippy_lints/src/use_self.rs @@ -141,7 +141,7 @@ fn check_trait_method_impl_decl<'a, 'tcx>( let impl_method_sig = cx.tcx.fn_sig(impl_method_def_id); let impl_method_sig = cx.tcx.erase_late_bound_regions(&impl_method_sig); - let output_ty = if let FunctionRetTy::Return(ty) = &impl_decl.output { + let output_ty = if let FnRetTy::Return(ty) = &impl_decl.output { Some(&**ty) } else { None diff --git a/clippy_lints/src/utils/hir_utils.rs b/clippy_lints/src/utils/hir_utils.rs index c209ebaaf137..f5f35afa9baa 100644 --- a/clippy_lints/src/utils/hir_utils.rs +++ b/clippy_lints/src/utils/hir_utils.rs @@ -633,10 +633,10 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> { self.hash_ty(&arg); } match bfn.decl.output { - FunctionRetTy::DefaultReturn(_) => { + FnRetTy::DefaultReturn(_) => { ().hash(&mut self.s); }, - FunctionRetTy::Return(ref ty) => { + FnRetTy::Return(ref ty) => { self.hash_ty(ty); }, }