derive_more
derive_more copied to clipboard
Clippy attributes doesn't work with `Constructor`
For example when tried to apply #[allow(clippy::too_many_arguments)] it has no effect.
But it works for Debug.
use derive_more::Constructor;
#[allow(clippy::too_many_arguments)]
#[derive(Debug, Constructor)]
struct Test{
a: u64,
b: u64,
c: u64,
d: u64,
e: u64,
f: u64,
g: u64,
h: u64,
i: u64
}
fn main() {
let test = Test::new(1,2,3,4,5,6,7,8,9);
println!("{:?}", test);
}
cargo expand output:
#![feature(prelude_import)]
#[prelude_import]
use std::prelude::rust_2021::*;
#[macro_use]
extern crate std;
use derive_more::Constructor;
#[allow(clippy::too_many_arguments)]
struct Test {
a: u64,
b: u64,
c: u64,
d: u64,
e: u64,
f: u64,
g: u64,
h: u64,
i: u64,
}
#[automatically_derived]
#[allow(clippy::too_many_arguments)]
impl ::core::fmt::Debug for Test {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ = &["a", "b", "c", "d", "e", "f", "g", "h", "i"];
let values: &[&dyn ::core::fmt::Debug] = &[
&self.a, &self.b, &self.c, &self.d, &self.e, &self.f, &self.g, &self.h, &&self.i,
];
::core::fmt::Formatter::debug_struct_fields_finish(f, "Test", names, values)
}
}
#[allow(missing_docs)]
#[automatically_derived]
impl Test {
#[inline]
pub const fn new(
a: u64,
b: u64,
c: u64,
d: u64,
e: u64,
f: u64,
g: u64,
h: u64,
i: u64,
) -> Test {
Test {
a: a,
b: b,
c: c,
d: d,
e: e,
f: f,
g: g,
h: h,
i: i,
}
}
}
fn main() {
let test = Test::new(1, 2, 3, 4, 5, 6, 7, 8, 9);
{
::std::io::_print(format_args!("{0:?}\n", test));
};
}
Yeah makes sense, I would accept a fix for this issue. I think the easiest is to always add this #[allow] to the constructor field.
Yeah makes sense, I would accept a fix for this issue. I think the easiest is to always add this
#[allow]to the constructor field.
Could you tell me how long I should wait?
How long to wait for what?
How long to wait for what?
Add this macro for method new #[allow(clippy::too_many_arguments)]
Like I said in the comment you quoted: feel free to create a PR to do so... If no-one does that you can can wait a long time... That's why I added the help-wanted label...