From 3a30256d8171c8793b18ed1a748030882cdc9513 Mon Sep 17 00:00:00 2001 From: Will Bush Date: Wed, 30 Oct 2024 12:37:09 -0500 Subject: [PATCH] Revert "lint: rename ratchet::RatchetState to ratchet::State" This reverts commit 14d1778eed264dbe7d3ab6ad6783e991a4dc2583. --- src/eval.rs | 6 +++--- src/main.rs | 3 +++ src/ratchet.rs | 12 ++++++------ src/status.rs | 1 - 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/eval.rs b/src/eval.rs index 08399ee..e469aa0 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -9,7 +9,7 @@ use crate::nix_file::CallPackageArgumentInfo; use crate::problem::{ npv_100, npv_101, npv_102, npv_103, npv_104, npv_105, npv_106, npv_107, npv_108, npv_120, }; -use crate::ratchet::State::{Loose, Tight}; +use crate::ratchet::RatchetState::{Loose, Tight}; use crate::structure::{self, BASE_SUBPATH}; use crate::validation::ResultIteratorExt as _; use crate::validation::{self, Validation::Success}; @@ -398,7 +398,7 @@ fn by_name_override( optional_syntactic_call_package: Option, definition: String, location: location::Location, -) -> validation::Validation> { +) -> validation::Validation> { let Some(syntactic_call_package) = optional_syntactic_call_package else { // Something like ` = foo` return npv_104::ByNameOverrideOfNonSyntacticCallPackage::new( @@ -455,7 +455,7 @@ fn handle_non_by_name_attribute( attribute_name: &str, non_by_name_attribute: NonByNameAttribute, ) -> validation::Result { - use ratchet::State::{Loose, NonApplicable, Tight}; + use ratchet::RatchetState::{Loose, NonApplicable, Tight}; use NonByNameAttribute::EvalSuccess; // The ratchet state whether this attribute uses `pkgs/by-name`. diff --git a/src/main.rs b/src/main.rs index e65ae8d..ee53f1c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,7 @@ #![warn(clippy::pedantic, clippy::nursery)] +// too many false-positives. discussion: +// https://github.com/NixOS/nixpkgs-vet/pull/124#pullrequestreview-2405109643 +#![allow(clippy::module_name_repetitions)] mod eval; mod location; diff --git a/src/ratchet.rs b/src/ratchet.rs index 16657c0..0367f76 100644 --- a/src/ratchet.rs +++ b/src/ratchet.rs @@ -35,22 +35,22 @@ impl Nixpkgs { /// The ratchet value for a top-level package pub struct Package { /// The ratchet value for the check for non-auto-called empty arguments - pub manual_definition: State, + pub manual_definition: RatchetState, /// The ratchet value for the check for new packages using pkgs/by-name - pub uses_by_name: State, + pub uses_by_name: RatchetState, } impl Package { /// Validates the ratchet checks for a top-level package pub fn compare(name: &str, optional_from: Option<&Self>, to: &Self) -> Validation<()> { validation::sequence_([ - State::::compare( + RatchetState::::compare( name, optional_from.map(|x| &x.manual_definition), &to.manual_definition, ), - State::::compare( + RatchetState::::compare( name, optional_from.map(|x| &x.uses_by_name), &to.uses_by_name, @@ -60,7 +60,7 @@ impl Package { } /// The ratchet state of a generic ratchet check. -pub enum State { +pub enum RatchetState { /// The ratchet is loose. It can be tightened more. In other words, this is the legacy state /// we're trying to move away from. /// @@ -86,7 +86,7 @@ pub trait ToProblem { fn to_problem(name: &str, optional_from: Option<()>, to: &Self::ToContext) -> Problem; } -impl State { +impl RatchetState { /// Compare the previous ratchet state of an attribute to the new state. /// The previous state may be `None` in case the attribute is new. fn compare(name: &str, optional_from: Option<&Self>, to: &Self) -> Validation<()> { diff --git a/src/status.rs b/src/status.rs index deb3478..80c42c3 100644 --- a/src/status.rs +++ b/src/status.rs @@ -101,7 +101,6 @@ impl fmt::Display for Status { } } -#[allow(clippy::module_name_repetitions)] pub struct ColoredStatus(Status); impl From for ColoredStatus {