Skip to content

Commit a503057

Browse files
committed
clippy test added
1 parent c588ff5 commit a503057

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.github/workflows/rust.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ jobs:
2323
run: |
2424
rustup toolchain install ${{ matrix.rust }}
2525
rustup default ${{ matrix.rust }}
26+
27+
- name: Install Rust toolchain
28+
run: rustup component add rustfmt clippy
29+
30+
- name: Run clippy without default features
31+
run: cargo clippy --all-targets --no-default-features --all-features -- --deny warnings
32+
33+
- name: Run rustfmt
34+
run: cargo fmt --check -- --config "unstable_features=true,imports_granularity=Crate,group_imports=StdExternalCrate"
35+
2636
- name: Build
2737
run: cargo build
2838
- name: Run tests

prebindgen-proc-macro/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl Parse for PrebindgenArgs {
109109
}
110110

111111
thread_local! {
112-
static THREAD_ID: std::cell::RefCell<Option<u64>> = std::cell::RefCell::new(None);
112+
static THREAD_ID: std::cell::RefCell<Option<u64>> = const { std::cell::RefCell::new(None) };
113113
static JSONL_PATHS: std::cell::RefCell<HashMap<String, std::path::PathBuf>> = std::cell::RefCell::new(HashMap::new());
114114
}
115115

@@ -271,7 +271,7 @@ pub fn prebindgen(args: TokenStream, input: TokenStream) -> TokenStream {
271271

272272
// Get the full path to the JSONL file
273273
let file_path = get_prebindgen_jsonl_path(&group);
274-
if let Err(_) = prebindgen::utils::write_to_jsonl_file(&file_path, &[&new_record]) {
274+
if prebindgen::utils::write_to_jsonl_file(&file_path, &[&new_record]).is_err() {
275275
return TokenStream::from(quote! {
276276
compile_error!("Failed to write prebindgen record");
277277
});

0 commit comments

Comments
 (0)