Skip to content

Commit e47f565

Browse files
clippy: migrate BareFn -> FnPtr
1 parent 5c8ac15 commit e47f565

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

src/tools/clippy/clippy_lints/src/dereference.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ impl TyCoercionStability {
824824
TyKind::Slice(_)
825825
| TyKind::Array(..)
826826
| TyKind::Ptr(_)
827-
| TyKind::BareFn(_)
827+
| TyKind::FnPtr(_)
828828
| TyKind::Pat(..)
829829
| TyKind::Never
830830
| TyKind::Tup(_)

src/tools/clippy/clippy_lints/src/lifetimes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc_hir::intravisit::{
1313
walk_poly_trait_ref, walk_trait_ref, walk_ty, walk_unambig_ty, walk_where_predicate,
1414
};
1515
use rustc_hir::{
16-
AmbigArg, BareFnTy, BodyId, FnDecl, FnSig, GenericArg, GenericArgs, GenericBound, GenericParam, GenericParamKind,
16+
AmbigArg, BodyId, FnDecl, FnPtrTy, FnSig, GenericArg, GenericArgs, GenericBound, GenericParam, GenericParamKind,
1717
Generics, HirId, Impl, ImplItem, ImplItemKind, Item, ItemKind, Lifetime, LifetimeKind, LifetimeParamKind, Node,
1818
PolyTraitRef, PredicateOrigin, TraitFn, TraitItem, TraitItemKind, Ty, TyKind, WhereBoundPredicate, WherePredicate,
1919
WherePredicateKind, lang_items,
@@ -480,7 +480,7 @@ impl<'tcx> Visitor<'tcx> for RefVisitor<'_, 'tcx> {
480480

481481
fn visit_ty(&mut self, ty: &'tcx Ty<'_, AmbigArg>) {
482482
match ty.kind {
483-
TyKind::BareFn(&BareFnTy { decl, .. }) => {
483+
TyKind::FnPtr(&FnPtrTy { decl, .. }) => {
484484
let mut sub_visitor = RefVisitor::new(self.cx);
485485
sub_visitor.visit_fn_decl(decl);
486486
self.nested_elision_site_lts.append(&mut sub_visitor.all_lts());

src/tools/clippy/clippy_lints/src/types/type_complexity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl<'tcx> Visitor<'tcx> for TypeComplexityVisitor {
5050
TyKind::Path(..) | TyKind::Slice(..) | TyKind::Tup(..) | TyKind::Array(..) => (10 * self.nest, 1),
5151

5252
// function types bring a lot of overhead
53-
TyKind::BareFn(bare) if bare.abi == ExternAbi::Rust => (50 * self.nest, 1),
53+
TyKind::FnPtr(fn_ptr) if fn_ptr.abi == ExternAbi::Rust => (50 * self.nest, 1),
5454

5555
TyKind::TraitObject(param_bounds, _) => {
5656
let has_lifetime_parameters = param_bounds.iter().any(|bound| {

src/tools/clippy/clippy_utils/src/ast_utils/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ pub fn eq_ty(l: &Ty, r: &Ty) -> bool {
838838
(PinnedRef(ll, l), PinnedRef(rl, r)) => {
839839
both(ll.as_ref(), rl.as_ref(), |l, r| eq_id(l.ident, r.ident)) && l.mutbl == r.mutbl && eq_ty(&l.ty, &r.ty)
840840
},
841-
(BareFn(l), BareFn(r)) => {
841+
(FnPtr(l), FnPtr(r)) => {
842842
l.safety == r.safety
843843
&& eq_ext(&l.ext, &r.ext)
844844
&& over(&l.generic_params, &r.generic_params, eq_generic_param)

src/tools/clippy/clippy_utils/src/check_proc_macro.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -372,17 +372,17 @@ fn ty_search_pat(ty: &Ty<'_>) -> (Pat, Pat) {
372372
TyKind::Slice(..) | TyKind::Array(..) => (Pat::Str("["), Pat::Str("]")),
373373
TyKind::Ptr(MutTy { ty, .. }) => (Pat::Str("*"), ty_search_pat(ty).1),
374374
TyKind::Ref(_, MutTy { ty, .. }) => (Pat::Str("&"), ty_search_pat(ty).1),
375-
TyKind::BareFn(bare_fn) => (
376-
if bare_fn.safety.is_unsafe() {
375+
TyKind::FnPtr(fn_ptr) => (
376+
if fn_ptr.safety.is_unsafe() {
377377
Pat::Str("unsafe")
378-
} else if bare_fn.abi != ExternAbi::Rust {
378+
} else if fn_ptr.abi != ExternAbi::Rust {
379379
Pat::Str("extern")
380380
} else {
381381
Pat::MultiStr(&["fn", "extern"])
382382
},
383-
match bare_fn.decl.output {
383+
match fn_ptr.decl.output {
384384
FnRetTy::DefaultReturn(_) => {
385-
if let [.., ty] = bare_fn.decl.inputs {
385+
if let [.., ty] = fn_ptr.decl.inputs {
386386
ty_search_pat(ty).1
387387
} else {
388388
Pat::Str("(")

src/tools/clippy/clippy_utils/src/hir_utils.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,20 +1283,20 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
12831283
self.hash_ty(mut_ty.ty);
12841284
mut_ty.mutbl.hash(&mut self.s);
12851285
},
1286-
TyKind::BareFn(bfn) => {
1287-
bfn.safety.hash(&mut self.s);
1288-
bfn.abi.hash(&mut self.s);
1289-
for arg in bfn.decl.inputs {
1286+
TyKind::FnPtr(fn_ptr) => {
1287+
fn_ptr.safety.hash(&mut self.s);
1288+
fn_ptr.abi.hash(&mut self.s);
1289+
for arg in fn_ptr.decl.inputs {
12901290
self.hash_ty(arg);
12911291
}
1292-
std::mem::discriminant(&bfn.decl.output).hash(&mut self.s);
1293-
match bfn.decl.output {
1292+
std::mem::discriminant(&fn_ptr.decl.output).hash(&mut self.s);
1293+
match fn_ptr.decl.output {
12941294
FnRetTy::DefaultReturn(_) => {},
12951295
FnRetTy::Return(ty) => {
12961296
self.hash_ty(ty);
12971297
},
12981298
}
1299-
bfn.decl.c_variadic.hash(&mut self.s);
1299+
fn_ptr.decl.c_variadic.hash(&mut self.s);
13001300
},
13011301
TyKind::Tup(ty_list) => {
13021302
for ty in *ty_list {

0 commit comments

Comments
 (0)