File tree Expand file tree Collapse file tree 2 files changed +18
-10
lines changed
Expand file tree Collapse file tree 2 files changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -51,14 +51,17 @@ fn check_files_top_level_with_lib(
5151 nixpkgs_path : & Path ,
5252 nix_file : & nix_file:: NixFile ,
5353) -> RatchetState < ratchet:: DoesNotIntroduceToplevelWiths > {
54- if let Some ( _open_scope_with_lib ) = find_invalid_withs ( nix_file. syntax_root . syntax ( ) ) {
54+ if let Some ( open_scope_with_lib ) = find_invalid_withs ( nix_file. syntax_root . syntax ( ) ) {
5555 RatchetState :: Loose (
56- npv_169:: TopLevelWithMayShadowVariablesAndBreakStaticChecks :: new (
57- RelativePathBuf :: from_path (
58- nix_file. path . clone ( ) . strip_prefix ( nixpkgs_path) . unwrap ( ) ,
56+ {
57+ npv_169:: TopLevelWithMayShadowVariablesAndBreakStaticChecks :: new (
58+ RelativePathBuf :: from_path (
59+ nix_file. path . clone ( ) . strip_prefix ( nixpkgs_path) . unwrap ( ) ,
60+ )
61+ . unwrap ( ) ,
62+ open_scope_with_lib. to_string ( ) ,
5963 )
60- . unwrap ( ) ,
61- )
64+ }
6265 . into ( ) ,
6366 )
6467 } else {
Original file line number Diff line number Diff line change 1- use derive_new:: new;
21use relative_path:: RelativePathBuf ;
32use std:: fmt;
43
5- #[ derive( Clone , new ) ]
4+ #[ derive( Clone ) ]
65pub struct TopLevelWithMayShadowVariablesAndBreakStaticChecks {
7- #[ new( into) ]
86 file : RelativePathBuf ,
7+ node : String ,
8+ }
9+
10+ impl TopLevelWithMayShadowVariablesAndBreakStaticChecks {
11+ pub fn new ( file : RelativePathBuf , node : String ) -> Self {
12+ Self { file, node }
13+ }
914}
1015
1116impl fmt:: Display for TopLevelWithMayShadowVariablesAndBreakStaticChecks {
1217 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
13- let Self { file } = self ;
18+ let Self { file, node : _node } = self ;
1419 write ! ( f, "- {file}: Top level with is discouraged as it may shadow variables and break static checks." )
1520 }
1621}
You can’t perform that action at this time.
0 commit comments