diff --git a/src/problem/npv_170.rs b/src/problem/npv_170.rs index 6614951..c540051 100644 --- a/src/problem/npv_170.rs +++ b/src/problem/npv_170.rs @@ -19,7 +19,7 @@ impl fmt::Display for ByNamePackegPrefixedWithNumber { } = self; write!( f, - r#"- {relative_package_dir}: Attribute `{package_name}` should not be number-prefixed. It is suggestet to `"`-wrap this name"# + "- {relative_package_dir}: Attribute `{package_name}` should not be number-prefixed. Prefix with `_`, or wrap in quotes" ) } } diff --git a/src/structure.rs b/src/structure.rs index 5e19da8..966326d 100644 --- a/src/structure.rs +++ b/src/structure.rs @@ -140,11 +140,7 @@ fn check_package( } else { let package_name_valid = PACKAGE_NAME_REGEX.is_match(&package_name); let result = if !package_name_valid { - if package_name - .chars() - .next() - .is_some_and(|c| c.is_ascii_digit()) - { + if package_name.starts_with(|c: char| c.is_ascii_digit()) { npv_170::ByNamePackegPrefixedWithNumber::new( package_name.clone(), relative_package_dir.clone(), diff --git a/tests/by-name-numprefix/pkgs/by-name/_1/10foo/package.nix b/tests/by-name-numprefix/pkgs/by-name/_1/10foo/package.nix index 9fb8b5d..ce29e51 100644 --- a/tests/by-name-numprefix/pkgs/by-name/_1/10foo/package.nix +++ b/tests/by-name-numprefix/pkgs/by-name/_1/10foo/package.nix @@ -1,4 +1 @@ -{ someDrv }: -SomeDrv -# If we caused an actual Nix failure -# builtins.trace "This should be on stderr!" throw "This is an error!" +{ someDrv }: SomeDrv