Skip to content

Commit

Permalink
Add clippy to pipeline and fix remaining issues (#5183)
Browse files Browse the repository at this point in the history
* Fix all clippy lints

* Add clippy to pipeline

* Fix toolchain for REPL
  • Loading branch information
lukastaegert authored Oct 9, 2023
1 parent c453664 commit 080d224
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 174 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
"lint:js:nofix": "eslint . --cache",
"lint:markdown": "prettier --write \"**/*.md\"",
"lint:markdown:nofix": "prettier --check \"**/*.md\"",
"lint:rust": "cd rust && cargo fmt",
"lint:rust:nofix": "cd rust && cargo fmt --check",
"lint:rust": "cd rust && cargo fmt && cargo clippy --fix --allow-dirty",
"lint:rust:nofix": "cd rust && cargo fmt --check && cargo clippy",
"perf": "npm run build:cjs && node --expose-gc scripts/perf.js",
"perf:init": "node scripts/perf-init.js",
"prepare": "husky install && node scripts/check-release.js || npm run build:prepare",
Expand Down
2 changes: 0 additions & 2 deletions rust/bindings_napi/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![deny(clippy::all)]

use napi::bindgen_prelude::*;
use napi_derive::napi;
use parse_ast::parse_ast;
Expand Down
5 changes: 1 addition & 4 deletions rust/parse_ast/src/convert_ast/annotations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ pub struct SequentialComments {
annotations: RefCell<Vec<AnnotationWithType>>,
}

const ASCII_AT: u8 = '@' as u8;
const ASCII_HASH: u8 = '#' as u8;

impl SequentialComments {
pub fn add_comment(&self, comment: Comment) {
if comment.text.starts_with('#') && comment.text.contains("sourceMappingURL=") {
Expand All @@ -31,7 +28,7 @@ impl SequentialComments {
search_position += match_position;
// Using a byte reference avoids UTF8 character boundary checks
match &comment.text.as_bytes()[search_position - 1] {
&ASCII_AT | &ASCII_HASH => {
b'@' | b'#' => {
let annotation_slice = &comment.text[search_position..];
if annotation_slice.starts_with("__PURE__") {
self.annotations.borrow_mut().push(AnnotationWithType {
Expand Down
Loading

0 comments on commit 080d224

Please sign in to comment.