Skip to content

Commit

Permalink
Revert "lint: rename ratchet::RatchetState to ratchet::State"
Browse files Browse the repository at this point in the history
This reverts commit 14d1778.
  • Loading branch information
willbush committed Oct 30, 2024
1 parent 313e68a commit 3a30256
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -398,7 +398,7 @@ fn by_name_override(
optional_syntactic_call_package: Option<CallPackageArgumentInfo>,
definition: String,
location: location::Location,
) -> validation::Validation<ratchet::State<ratchet::ManualDefinition>> {
) -> validation::Validation<ratchet::RatchetState<ratchet::ManualDefinition>> {
let Some(syntactic_call_package) = optional_syntactic_call_package else {
// Something like `<attr> = foo`
return npv_104::ByNameOverrideOfNonSyntacticCallPackage::new(
Expand Down Expand Up @@ -455,7 +455,7 @@ fn handle_non_by_name_attribute(
attribute_name: &str,
non_by_name_attribute: NonByNameAttribute,
) -> validation::Result<ratchet::Package> {
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`.
Expand Down
3 changes: 3 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
12 changes: 6 additions & 6 deletions src/ratchet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ManualDefinition>,
pub manual_definition: RatchetState<ManualDefinition>,

/// The ratchet value for the check for new packages using pkgs/by-name
pub uses_by_name: State<UsesByName>,
pub uses_by_name: RatchetState<UsesByName>,
}

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::<ManualDefinition>::compare(
RatchetState::<ManualDefinition>::compare(
name,
optional_from.map(|x| &x.manual_definition),
&to.manual_definition,
),
State::<UsesByName>::compare(
RatchetState::<UsesByName>::compare(
name,
optional_from.map(|x| &x.uses_by_name),
&to.uses_by_name,
Expand All @@ -60,7 +60,7 @@ impl Package {
}

/// The ratchet state of a generic ratchet check.
pub enum State<Ratchet: ToProblem> {
pub enum RatchetState<Ratchet: ToProblem> {
/// The ratchet is loose. It can be tightened more. In other words, this is the legacy state
/// we're trying to move away from.
///
Expand All @@ -86,7 +86,7 @@ pub trait ToProblem {
fn to_problem(name: &str, optional_from: Option<()>, to: &Self::ToContext) -> Problem;
}

impl<Context: ToProblem> State<Context> {
impl<Context: ToProblem> RatchetState<Context> {
/// 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<()> {
Expand Down
1 change: 0 additions & 1 deletion src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ impl fmt::Display for Status {
}
}

#[allow(clippy::module_name_repetitions)]
pub struct ColoredStatus(Status);

impl From<Status> for ColoredStatus {
Expand Down

0 comments on commit 3a30256

Please sign in to comment.