From f56e8b7eb47402056b851b11203acfa0994bc8e0 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Mon, 17 Feb 2020 18:36:17 +0900 Subject: [PATCH] Rename `FunctionRetTy` to `FnRetTy` --- clippy_lints/src/functions.rs | 4 ++-- clippy_lints/src/lifetimes.rs | 2 +- clippy_lints/src/methods/mod.rs | 12 ++++++------ clippy_lints/src/ptr.rs | 2 +- clippy_lints/src/returns.rs | 2 +- clippy_lints/src/types.rs | 4 ++-- clippy_lints/src/use_self.rs | 2 +- clippy_lints/src/utils/hir_utils.rs | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/clippy_lints/src/functions.rs b/clippy_lints/src/functions.rs index ee9221c811e..ce0bfea5160 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 13484ba0fa7..f98021bca45 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 d8494865477..00a9fd89464 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 445f065aace..33cfa5d75c6 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 6bf373a9a62..fc371dccd73 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 e47f2480a54..d23487b5b33 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 9be070bd3d1..da961a5f89d 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 c209ebaaf13..f5f35afa9ba 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); }, }