Lints and suggestions for the Nix programming language
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #94 from dbast/update

Lint the linter via clippy + handle/fix findings

authored by

Shahar "Dawn" Or and committed by
GitHub
33db3fb1 877156f5

+19 -10
+2 -2
.github/workflows/build.yml
··· 6 6 tests: 7 7 runs-on: ubuntu-latest 8 8 steps: 9 - - uses: actions/checkout@v3 10 - - uses: cachix/install-nix-action@v18 9 + - uses: actions/checkout@v4 10 + - uses: cachix/install-nix-action@v30 11 11 with: 12 12 github_access_token: ${{ secrets.GITHUB_TOKEN }} 13 13 - name: build statix
+2 -7
bin/src/config.rs
··· 213 213 #[derive(Parser, Debug)] 214 214 pub struct List {} 215 215 216 - #[derive(Debug, Copy, Clone)] 216 + #[derive(Debug, Copy, Clone, Default)] 217 217 pub enum OutFormat { 218 218 #[cfg(feature = "json")] 219 219 Json, 220 220 Errfmt, 221 + #[default] 221 222 StdErr, 222 - } 223 - 224 - impl Default for OutFormat { 225 - fn default() -> Self { 226 - OutFormat::StdErr 227 - } 228 223 } 229 224 230 225 impl fmt::Display for OutFormat {
+1 -1
bin/src/traits.rs
··· 80 80 |cli_report, diagnostic| { 81 81 cli_report.with_label( 82 82 Label::new((src_id, range(diagnostic.at))) 83 - .with_message(&colorize(&diagnostic.message)) 83 + .with_message(colorize(&diagnostic.message)) 84 84 .with_color(Color::Magenta), 85 85 ) 86 86 },
+2
bin/src/utils.rs
··· 3 3 use lib::{Lint, LINTS}; 4 4 use rnix::SyntaxKind; 5 5 6 + #[allow(clippy::borrowed_box)] 6 7 pub fn lint_map_of( 7 8 lints: &[&'static Box<dyn Lint>], 8 9 ) -> HashMap<SyntaxKind, Vec<&'static Box<dyn Lint>>> { ··· 19 20 map 20 21 } 21 22 23 + #[allow(clippy::borrowed_box)] 22 24 pub fn lint_map() -> HashMap<SyntaxKind, Vec<&'static Box<dyn Lint>>> { 23 25 lint_map_of(&LINTS) 24 26 }
+9
flake.nix
··· 37 37 rustPlatform = makeRustPlatform { 38 38 inherit (rustChannel final) cargo rustc; 39 39 }; 40 + clippy = (rustChannel final).clippy; 40 41 in 41 42 rustPlatform.buildRustPackage { 42 43 inherit pname; ··· 54 55 homepage = "https://git.peppe.rs/languages/statix/about"; 55 56 license = licenses.mit; 56 57 }; 58 + 59 + nativeCheckInputs = [ clippy ]; 60 + 61 + postCheck = '' 62 + echo "Starting postCheck" 63 + cargo clippy 64 + echo "Finished postCheck" 65 + ''; 57 66 }; 58 67 59 68 statix-vim =
+3
vfs/src/lib.rs
··· 48 48 pub fn len(&self) -> usize { 49 49 self.data.len() 50 50 } 51 + pub fn is_empty(&self) -> bool { 52 + self.data.is_empty() 53 + } 51 54 pub fn file_path(&self, file_id: FileId) -> &Path { 52 55 self.interner.lookup(file_id).unwrap() 53 56 }