Skip to content

Commit f25ac1d

Browse files
authored
Merge pull request #797 from GuillaumeGomez/clean-up-allow
Replace `allow` attributes with `expect` and remove unused attributes
2 parents e785c50 + 884cea1 commit f25ac1d

File tree

12 files changed

+16
-36
lines changed

12 files changed

+16
-36
lines changed

src/attributes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ fn inline_attr<'gcc, 'tcx>(
8484
/// attributes.
8585
pub fn from_fn_attrs<'gcc, 'tcx>(
8686
cx: &CodegenCx<'gcc, 'tcx>,
87-
#[cfg_attr(not(feature = "master"), allow(unused_variables))] func: Function<'gcc>,
87+
#[cfg_attr(not(feature = "master"), expect(unused_variables))] func: Function<'gcc>,
8888
instance: ty::Instance<'tcx>,
8989
) {
9090
let codegen_fn_attrs = cx.tcx.codegen_instance_attrs(instance.def);

src/back/lto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ pub fn optimize_thin_module(
633633
save_temp_bitcode(cgcx, &module, "thin-lto-after-pm");
634634
}
635635
}*/
636-
#[allow(clippy::let_and_return)]
636+
#[expect(clippy::let_and_return)]
637637
module
638638
}
639639

src/builder.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,7 +1481,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
14811481
variable.to_rvalue()
14821482
}
14831483

1484-
#[allow(dead_code)]
14851484
fn va_arg(&mut self, _list: RValue<'gcc>, _ty: Type<'gcc>) -> RValue<'gcc> {
14861485
unimplemented!();
14871486
}
@@ -2517,7 +2516,7 @@ impl ToGccComp for RealPredicate {
25172516
}
25182517

25192518
#[repr(C)]
2520-
#[allow(non_camel_case_types)]
2519+
#[expect(non_camel_case_types)]
25212520
enum MemOrdering {
25222521
__ATOMIC_RELAXED,
25232522
__ATOMIC_CONSUME,

src/consts.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ impl<'gcc, 'tcx> StaticCodegenMethods for CodegenCx<'gcc, 'tcx> {
5858
global_value
5959
}
6060

61-
#[cfg_attr(not(feature = "master"), allow(unused_mut))]
6261
fn codegen_static(&mut self, def_id: DefId) {
6362
let attrs = self.tcx.codegen_fn_attrs(def_id);
6463

@@ -162,7 +161,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
162161
// TODO(antoyo)
163162
}
164163

165-
#[cfg_attr(not(feature = "master"), allow(unused_variables))]
164+
#[cfg_attr(not(feature = "master"), expect(unused_variables))]
166165
pub fn add_used_function(&self, function: Function<'gcc>) {
167166
#[cfg(feature = "master")]
168167
function.add_attribute(FnAttribute::Used);

src/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use crate::abi::conv_to_fn_attribute;
2828
use crate::callee::get_fn;
2929
use crate::common::SignType;
3030

31-
#[cfg_attr(not(feature = "master"), allow(dead_code))]
31+
#[cfg_attr(not(feature = "master"), expect(dead_code))]
3232
pub struct CodegenCx<'gcc, 'tcx> {
3333
/// A cache of converted ConstAllocs
3434
pub const_cache: RefCell<HashMap<Allocation, RValue<'gcc>>>,
@@ -132,7 +132,7 @@ pub struct CodegenCx<'gcc, 'tcx> {
132132
}
133133

134134
impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
135-
#[allow(clippy::too_many_arguments)]
135+
#[expect(clippy::too_many_arguments)]
136136
pub fn new(
137137
context: &'gcc Context<'gcc>,
138138
codegen_unit: &'tcx CodegenUnit<'tcx>,

src/declare.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
156156
///
157157
/// If there’s a value with the same name already declared, the function will
158158
/// update the declaration and return existing Value instead.
159-
#[allow(clippy::let_and_return)]
159+
#[expect(clippy::let_and_return)]
160160
fn declare_raw_fn<'gcc>(
161161
cx: &CodegenCx<'gcc, '_>,
162162
name: &str,

src/intrinsic/archs.rs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
1010
};
1111
match arch {
1212
"AMDGPU" => {
13-
#[allow(non_snake_case)]
13+
#[expect(non_snake_case)]
1414
fn AMDGPU(name: &str, full_name: &str) -> &'static str {
1515
match name {
1616
// AMDGPU
@@ -48,7 +48,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
4848
AMDGPU(name, full_name)
4949
}
5050
"aarch64" => {
51-
#[allow(non_snake_case)]
5251
fn aarch64(name: &str, full_name: &str) -> &'static str {
5352
match name {
5453
// aarch64
@@ -81,7 +80,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
8180
aarch64(name, full_name)
8281
}
8382
"amdgcn" => {
84-
#[allow(non_snake_case)]
8583
fn amdgcn(name: &str, full_name: &str) -> &'static str {
8684
match name {
8785
// amdgcn
@@ -524,7 +522,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
524522
amdgcn(name, full_name)
525523
}
526524
"arm" => {
527-
#[allow(non_snake_case)]
528525
fn arm(name: &str, full_name: &str) -> &'static str {
529526
match name {
530527
// arm
@@ -633,7 +630,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
633630
arm(name, full_name)
634631
}
635632
"bpf" => {
636-
#[allow(non_snake_case)]
637633
fn bpf(name: &str, full_name: &str) -> &'static str {
638634
match name {
639635
// bpf
@@ -655,7 +651,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
655651
bpf(name, full_name)
656652
}
657653
"cuda" => {
658-
#[allow(non_snake_case)]
659654
fn cuda(name: &str, full_name: &str) -> &'static str {
660655
match name {
661656
// cuda
@@ -666,7 +661,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
666661
cuda(name, full_name)
667662
}
668663
"hexagon" => {
669-
#[allow(non_snake_case)]
670664
fn hexagon(name: &str, full_name: &str) -> &'static str {
671665
match name {
672666
// hexagon
@@ -2653,7 +2647,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
26532647
hexagon(name, full_name)
26542648
}
26552649
"loongarch" => {
2656-
#[allow(non_snake_case)]
26572650
fn loongarch(name: &str, full_name: &str) -> &'static str {
26582651
match name {
26592652
// loongarch
@@ -4162,7 +4155,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
41624155
loongarch(name, full_name)
41634156
}
41644157
"mips" => {
4165-
#[allow(non_snake_case)]
41664158
fn mips(name: &str, full_name: &str) -> &'static str {
41674159
match name {
41684160
// mips
@@ -4843,7 +4835,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
48434835
mips(name, full_name)
48444836
}
48454837
"nvvm" => {
4846-
#[allow(non_snake_case)]
48474838
fn nvvm(name: &str, full_name: &str) -> &'static str {
48484839
match name {
48494840
// nvvm
@@ -5652,7 +5643,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
56525643
nvvm(name, full_name)
56535644
}
56545645
"ppc" => {
5655-
#[allow(non_snake_case)]
56565646
fn ppc(name: &str, full_name: &str) -> &'static str {
56575647
match name {
56585648
// ppc
@@ -6245,7 +6235,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
62456235
ppc(name, full_name)
62466236
}
62476237
"ptx" => {
6248-
#[allow(non_snake_case)]
62496238
fn ptx(name: &str, full_name: &str) -> &'static str {
62506239
match name {
62516240
// ptx
@@ -6273,7 +6262,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
62736262
ptx(name, full_name)
62746263
}
62756264
"r600" => {
6276-
#[allow(non_snake_case)]
62776265
fn r600(name: &str, full_name: &str) -> &'static str {
62786266
match name {
62796267
// r600
@@ -6298,7 +6286,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
62986286
r600(name, full_name)
62996287
}
63006288
"riscv" => {
6301-
#[allow(non_snake_case)]
63026289
fn riscv(name: &str, full_name: &str) -> &'static str {
63036290
match name {
63046291
// riscv
@@ -6332,7 +6319,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
63326319
riscv(name, full_name)
63336320
}
63346321
"s390" => {
6335-
#[allow(non_snake_case)]
63366322
fn s390(name: &str, full_name: &str) -> &'static str {
63376323
match name {
63386324
// s390
@@ -6526,7 +6512,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
65266512
s390(name, full_name)
65276513
}
65286514
"spv" => {
6529-
#[allow(non_snake_case)]
65306515
fn spv(name: &str, full_name: &str) -> &'static str {
65316516
match name {
65326517
// spv
@@ -6543,7 +6528,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
65436528
spv(name, full_name)
65446529
}
65456530
"ve" => {
6546-
#[allow(non_snake_case)]
65476531
fn ve(name: &str, full_name: &str) -> &'static str {
65486532
match name {
65496533
// ve
@@ -7816,7 +7800,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
78167800
ve(name, full_name)
78177801
}
78187802
"x86" => {
7819-
#[allow(non_snake_case)]
78207803
fn x86(name: &str, full_name: &str) -> &'static str {
78217804
match name {
78227805
// x86
@@ -10384,7 +10367,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
1038410367
x86(name, full_name)
1038510368
}
1038610369
"xcore" => {
10387-
#[allow(non_snake_case)]
1038810370
fn xcore(name: &str, full_name: &str) -> &'static str {
1038910371
match name {
1039010372
// xcore

src/intrinsic/llvm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ fn wide_aes_output_type<'a, 'gcc, 'tcx>(
8585
(aes_output_type.as_type(), field1, field2)
8686
}
8787

88-
#[cfg_attr(not(feature = "master"), allow(unused_variables))]
88+
#[cfg_attr(not(feature = "master"), expect(unused_variables))]
8989
pub fn adjust_function<'gcc>(
9090
context: &'gcc Context<'gcc>,
9191
func_name: &str,

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
* TODO(antoyo): remove the patches.
1414
*/
1515

16-
#![allow(internal_features)]
16+
#![expect(internal_features)]
1717
#![doc(rust_logo)]
1818
#![feature(rustdoc_internals)]
1919
#![feature(rustc_private)]
2020
#![recursion_limit = "256"]
2121
#![warn(rust_2018_idioms)]
2222
#![warn(unused_lifetimes)]
2323
#![deny(clippy::pattern_type_mismatch)]
24-
#![allow(clippy::needless_lifetimes, clippy::uninlined_format_args)]
24+
#![expect(clippy::uninlined_format_args)]
2525

2626
// The rustc crates we need
2727
extern crate rustc_abi;
@@ -46,7 +46,7 @@ extern crate rustc_target;
4646
extern crate rustc_type_ir;
4747

4848
// This prevents duplicating functions and statics that are already part of the host rustc process.
49-
#[allow(unused_extern_crates)]
49+
#[expect(unused_extern_crates)]
5050
extern crate rustc_driver;
5151

5252
mod abi;

src/mono_item.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::type_of::LayoutGccExt;
1515
use crate::{attributes, base};
1616

1717
impl<'gcc, 'tcx> PreDefineCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
18-
#[cfg_attr(not(feature = "master"), allow(unused_variables))]
18+
#[cfg_attr(not(feature = "master"), expect(unused_variables))]
1919
fn predefine_static(
2020
&mut self,
2121
def_id: DefId,
@@ -41,7 +41,6 @@ impl<'gcc, 'tcx> PreDefineCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
4141
self.instances.borrow_mut().insert(instance, global);
4242
}
4343

44-
#[cfg_attr(not(feature = "master"), allow(unused_variables))]
4544
fn predefine_fn(
4645
&mut self,
4746
instance: Instance<'tcx>,

0 commit comments

Comments
 (0)