Skip to content

Commit b18bb0a

Browse files
clippy: directly use rustc_abi instead of reexports
1 parent b43dc00 commit b18bb0a

20 files changed

+43
-41
lines changed

clippy_lints/src/casts/cast_possible_truncation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ use clippy_utils::expr_or_init;
44
use clippy_utils::source::snippet;
55
use clippy_utils::sugg::Sugg;
66
use clippy_utils::ty::{get_discriminant_value, is_isize_or_usize};
7+
use rustc_abi::IntegerType;
78
use rustc_errors::{Applicability, Diag};
89
use rustc_hir::def::{DefKind, Res};
910
use rustc_hir::{BinOpKind, Expr, ExprKind};
1011
use rustc_lint::LateContext;
1112
use rustc_middle::ty::{self, FloatTy, Ty};
1213
use rustc_span::Span;
13-
use rustc_target::abi::IntegerType;
1414

1515
use super::{CAST_ENUM_TRUNCATION, CAST_POSSIBLE_TRUNCATION, utils};
1616

clippy_lints/src/escape.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_session::impl_lint_pass;
1010
use rustc_span::Span;
1111
use rustc_span::def_id::LocalDefId;
1212
use rustc_span::symbol::kw;
13-
use rustc_target::spec::abi::Abi;
13+
use rustc_abi::ExternAbi;
1414

1515
pub struct BoxedLocal {
1616
too_large_for_stack: u64,
@@ -73,7 +73,7 @@ impl<'tcx> LateLintPass<'tcx> for BoxedLocal {
7373
fn_def_id: LocalDefId,
7474
) {
7575
if let Some(header) = fn_kind.header() {
76-
if header.abi != Abi::Rust {
76+
if header.abi != ExternAbi::Rust {
7777
return;
7878
}
7979
}

clippy_lints/src/eta_reduction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use rustc_middle::ty::{
1515
};
1616
use rustc_session::declare_lint_pass;
1717
use rustc_span::symbol::sym;
18-
use rustc_target::spec::abi::Abi;
18+
use rustc_abi::ExternAbi;
1919
use rustc_trait_selection::error_reporting::InferCtxtErrorExt as _;
2020

2121
declare_clippy_lint! {
@@ -172,7 +172,7 @@ fn check_closure<'tcx>(cx: &LateContext<'tcx>, outer_receiver: Option<&Expr<'tcx
172172
&& let output = typeck.expr_ty(body.value)
173173
&& let ty::Tuple(tys) = *subs.type_at(1).kind()
174174
{
175-
cx.tcx.mk_fn_sig(tys, output, false, Safety::Safe, Abi::Rust)
175+
cx.tcx.mk_fn_sig(tys, output, false, Safety::Safe, ExternAbi::Rust)
176176
} else {
177177
return;
178178
}

clippy_lints/src/excessive_bools.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_lint::{LateContext, LateLintPass};
77
use rustc_session::impl_lint_pass;
88
use rustc_span::Span;
99
use rustc_span::def_id::LocalDefId;
10-
use rustc_target::spec::abi::Abi;
10+
use rustc_abi::ExternAbi;
1111

1212
declare_clippy_lint! {
1313
/// ### What it does
@@ -145,7 +145,7 @@ impl<'tcx> LateLintPass<'tcx> for ExcessiveBools {
145145
fn check_trait_item(&mut self, cx: &LateContext<'tcx>, trait_item: &'tcx TraitItem<'tcx>) {
146146
// functions with a body are already checked by `check_fn`
147147
if let TraitItemKind::Fn(fn_sig, TraitFn::Required(_)) = &trait_item.kind
148-
&& fn_sig.header.abi == Abi::Rust
148+
&& fn_sig.header.abi == ExternAbi::Rust
149149
&& fn_sig.decl.inputs.len() as u64 > self.max_fn_params_bools
150150
{
151151
check_fn_decl(cx, fn_sig.decl, fn_sig.span, self.max_fn_params_bools);
@@ -162,7 +162,7 @@ impl<'tcx> LateLintPass<'tcx> for ExcessiveBools {
162162
def_id: LocalDefId,
163163
) {
164164
if let Some(fn_header) = fn_kind.header()
165-
&& fn_header.abi == Abi::Rust
165+
&& fn_header.abi == ExternAbi::Rust
166166
&& fn_decl.inputs.len() as u64 > self.max_fn_params_bools
167167
&& get_parent_as_impl(cx.tcx, cx.tcx.local_def_id_to_hir_id(def_id))
168168
.is_none_or(|impl_item| impl_item.of_trait.is_none())

clippy_lints/src/functions/too_many_arguments.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rustc_hir::{self as hir, intravisit};
22
use rustc_lint::LateContext;
33
use rustc_span::Span;
4-
use rustc_target::spec::abi::Abi;
4+
use rustc_abi::ExternAbi;
55

66
use clippy_utils::diagnostics::span_lint;
77
use clippy_utils::is_trait_impl_item;
@@ -23,11 +23,11 @@ pub(super) fn check_fn(
2323
intravisit::FnKind::Method(
2424
_,
2525
&hir::FnSig {
26-
header: hir::FnHeader { abi: Abi::Rust, .. },
26+
header: hir::FnHeader { abi: ExternAbi::Rust, .. },
2727
..
2828
},
2929
)
30-
| intravisit::FnKind::ItemFn(_, _, hir::FnHeader { abi: Abi::Rust, .. }) => check_arg_number(
30+
| intravisit::FnKind::ItemFn(_, _, hir::FnHeader { abi: ExternAbi::Rust, .. }) => check_arg_number(
3131
cx,
3232
decl,
3333
span.with_hi(decl.output.span().hi()),
@@ -41,7 +41,7 @@ pub(super) fn check_fn(
4141
pub(super) fn check_trait_item(cx: &LateContext<'_>, item: &hir::TraitItem<'_>, too_many_arguments_threshold: u64) {
4242
if let hir::TraitItemKind::Fn(ref sig, _) = item.kind {
4343
// don't lint extern functions decls, it's not their fault
44-
if sig.header.abi == Abi::Rust {
44+
if sig.header.abi == ExternAbi::Rust {
4545
check_arg_number(
4646
cx,
4747
sig.decl,

clippy_lints/src/inherent_to_string.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_hir::{GenericParamKind, ImplItem, ImplItemKind, LangItem};
55
use rustc_lint::{LateContext, LateLintPass};
66
use rustc_session::declare_lint_pass;
77
use rustc_span::sym;
8-
use rustc_target::spec::abi::Abi;
8+
use rustc_abi::ExternAbi;
99

1010
declare_clippy_lint! {
1111
/// ### What it does
@@ -96,7 +96,7 @@ impl<'tcx> LateLintPass<'tcx> for InherentToString {
9696
// #11201
9797
&& let header = signature.header
9898
&& header.is_safe()
99-
&& header.abi == Abi::Rust
99+
&& header.abi == ExternAbi::Rust
100100
&& impl_item.ident.name == sym::to_string
101101
&& let decl = signature.decl
102102
&& decl.implicit_self.has_implicit_self()

clippy_lints/src/large_futures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ use clippy_config::Conf;
22
use clippy_utils::diagnostics::span_lint_and_sugg;
33
use clippy_utils::source::snippet;
44
use clippy_utils::ty::implements_trait;
5+
use rustc_abi::Size;
56
use rustc_errors::Applicability;
67
use rustc_hir::{Expr, ExprKind, LangItem, MatchSource, QPath};
78
use rustc_lint::{LateContext, LateLintPass};
89
use rustc_session::impl_lint_pass;
9-
use rustc_target::abi::Size;
1010

1111
declare_clippy_lint! {
1212
/// ### What it does

clippy_lints/src/methods/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ use clippy_utils::msrvs::{self, Msrv};
149149
use clippy_utils::ty::{contains_ty_adt_constructor_opaque, implements_trait, is_copy, is_type_diagnostic_item};
150150
use clippy_utils::{contains_return, is_bool, is_trait_method, iter_input_pats, peel_blocks, return_ty};
151151
pub use path_ends_with_ext::DEFAULT_ALLOWED_DOTFILES;
152+
use rustc_abi::ExternAbi;
152153
use rustc_data_structures::fx::FxHashSet;
153154
use rustc_hir as hir;
154155
use rustc_hir::{Expr, ExprKind, Node, Stmt, StmtKind, TraitItem, TraitItemKind};
@@ -5447,7 +5448,7 @@ const FN_HEADER: hir::FnHeader = hir::FnHeader {
54475448
safety: hir::HeaderSafety::Normal(hir::Safety::Safe),
54485449
constness: hir::Constness::NotConst,
54495450
asyncness: hir::IsAsync::NotAsync,
5450-
abi: rustc_target::spec::abi::Abi::Rust,
5451+
abi: ExternAbi::Rust,
54515452
};
54525453

54535454
struct ShouldImplTraitCase {

clippy_lints/src/missing_const_for_fn.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
use clippy_config::Conf;
23
use clippy_utils::diagnostics::span_lint_and_then;
34
use clippy_utils::msrvs::{self, Msrv};
@@ -12,7 +13,7 @@ use rustc_middle::ty;
1213
use rustc_session::impl_lint_pass;
1314
use rustc_span::Span;
1415
use rustc_span::def_id::LocalDefId;
15-
use rustc_target::spec::abi::Abi;
16+
use rustc_abi::ExternAbi;
1617

1718
declare_clippy_lint! {
1819
/// ### What it does
@@ -183,11 +184,11 @@ fn already_const(header: hir::FnHeader) -> bool {
183184
header.constness == Constness::Const
184185
}
185186

186-
fn could_be_const_with_abi(msrv: &Msrv, abi: Abi) -> bool {
187+
fn could_be_const_with_abi(msrv: &Msrv, abi: ExternAbi) -> bool {
187188
match abi {
188-
Abi::Rust => true,
189+
ExternAbi::Rust => true,
189190
// `const extern "C"` was stabilized after 1.62.0
190-
Abi::C { unwind: false } => msrv.meets(msrvs::CONST_EXTERN_C_FN),
191+
ExternAbi::C { unwind: false } => msrv.meets(msrvs::CONST_EXTERN_C_FN),
191192
// Rest ABIs are still unstable and need the `const_extern_fn` feature enabled.
192193
_ => msrv.meets(msrvs::CONST_EXTERN_FN),
193194
}

clippy_lints/src/needless_pass_by_ref_mut.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_session::impl_lint_pass;
2020
use rustc_span::Span;
2121
use rustc_span::def_id::LocalDefId;
2222
use rustc_span::symbol::kw;
23-
use rustc_target::spec::abi::Abi;
23+
use rustc_abi::ExternAbi;
2424

2525
declare_clippy_lint! {
2626
/// ### What it does
@@ -149,7 +149,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByRefMut<'tcx> {
149149
return;
150150
}
151151
let attrs = cx.tcx.hir().attrs(hir_id);
152-
if header.abi != Abi::Rust || requires_exact_signature(attrs) {
152+
if header.abi != ExternAbi::Rust || requires_exact_signature(attrs) {
153153
return;
154154
}
155155
header.is_async()

0 commit comments

Comments
 (0)