chore(rust): allow clippy::new_without_default

This commit is contained in:
Boshen committed 2023-05-13 15:07:00 +08:00
1 parent 7b834d4bd9
commit 2812591e4a
4 files changed
+8 -5

No files matched your search

+6 -2
View File
@@ -18,8 +18,7 @@ protocol = "sparse"
rustflags = [
# CLIPPY LINT SETTINGS
# This is a workaround to configure lints for the entire workspace, pending the ability to configure this via TOML.
# See: `https://github.com/rust-lang/cargo/issues/5034`
# `https://github.com/EmbarkStudios/rust-ecosystem/issues/22#issuecomment-947011395`
# Wait for [RFC3389](https://github.com/rust-lang/rfcs/pull/3389) and [Tracking Issue](https://github.com/rust-lang/cargo/issues/12115)
"-Wclippy::all",
# I want to write the best Rust code so both pedantic and nursery is enabled.
@@ -68,4 +67,9 @@ rustflags = [
# `const` functions do not make sense for our project because this is not a `const` library.
# This rule also confuses new comers and forces them to add `const` blindlessly without any reason.
"-Aclippy::missing_const_for_fn",
# style
# Having both `new` and `default` for a struct is confusing, just implement the more appropriate one.
"-Aclippy::new_without_default",
]
+1 -1
View File
@@ -831,7 +831,7 @@ pub struct Modifier {
pub kind: ModifierKind,
}
#[derive(Debug, Hash, Default)]
#[derive(Debug, Default, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde(transparent))]
pub struct Modifiers<'a>(Option<Vec<'a, Modifier>>);
-1
View File
@@ -33,7 +33,6 @@ pub struct Linter {
}
impl Linter {
#[allow(clippy::new_without_default)]
pub fn new() -> Self {
let rules = RULES
.iter()
+1 -1
View File
@@ -18,7 +18,7 @@ use crate::{
bitflags! {
/// Bitflag of modifiers and contextual modifiers.
/// Useful to cheaply track all already seen modifiers of a member (instead of using a HashSet<ModifierKind>).
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ModifierFlags: u16 {
const DECLARE = 1 << 0;
const PRIVATE = 1 << 1;