diff --git a/.forgejo/workflows/uwu.yaml b/.forgejo/workflows/uwu.yaml index 32dd838..ad8b84b 100644 --- a/.forgejo/workflows/uwu.yaml +++ b/.forgejo/workflows/uwu.yaml @@ -23,3 +23,26 @@ jobs: run: | cargo test --lib shell: bash + + clippy: + runso-on: ubuntu-latest + steps: + - id: checkout + name: checkout + uses: actions/checkout@v4 + - id: setup-rust + name: setup rust + uses: https://github.com/ningenMe/setup-rustup@v1.1.0 + with: + rust-version: nightly + - id: cargo-clippy + name: cargo clippy + run: | + cargo clippy --fix --lib -p glsl-lexer + shell: bash + - id: commit + name: commit + uses: https://github.com/EndBug/add-and-commit@v9 + with: + author_name: [Clippy] + diff --git a/flake.lock b/flake.lock index be43e79..d7afaa7 100644 --- a/flake.lock +++ b/flake.lock @@ -81,11 +81,11 @@ "locked": { "lastModified": 1, "narHash": "sha256-8wkkYGr1dPSnX9oVMX8D6dTOROXKOYpBTKfriA0sEBI=", - "path": "/nix/store/m9vjlwhzw1n4lgswgx8zh6ninlvghkdh-source/flake.systems.nix", + "path": "/nix/store/wdwf2qq1sqhs0nig8rffrq5dbpwr27v6-source/flake.systems.nix", "type": "path" }, "original": { - "path": "/nix/store/m9vjlwhzw1n4lgswgx8zh6ninlvghkdh-source/flake.systems.nix", + "path": "/nix/store/wdwf2qq1sqhs0nig8rffrq5dbpwr27v6-source/flake.systems.nix", "type": "path" } }, diff --git a/src/handlers.rs b/src/handlers.rs index 200ff1b..b69aa0e 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -37,10 +37,10 @@ impl crate::Lexer { let mut is_swizzle = false; while let Some(c) = self.current_char { - if c.is_digit(10) { + if c.is_ascii_digit() { number.push(c); self.advance(); - } else if c == '.' && self.peek().map_or(false, |c| c.is_digit(10)) + } else if c == '.' && self.peek().map_or(false, |c| c.is_ascii_digit()) || self.peek() == Some('f') { if number.is_empty() { diff --git a/src/lib.rs b/src/lib.rs index e6d2db8..a3181d3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -105,7 +105,7 @@ impl Lexer { tokens.push(Token::Whitespace); } else if c.is_alphabetic() || c == '_' { tokens.push(self.consume_identifier_or_keyword()); - } else if c.is_digit(10) { + } else if c.is_ascii_digit() { tokens.push(self.consume_number()); } else if c == '/' && self.peek() == Some('/') { tokens.push(self.consume_comment());