Skip to content

Commit

Permalink
fix: clippy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
coroiu committed Nov 12, 2024
1 parent 2017aea commit 60a5091
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/bitwarden-error-macro/src/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub(crate) fn bitwarden_error(
let BitwardenErrorArgs { error_type } = match BitwardenErrorArgs::from_list(&attr_args) {
Ok(params) => params,
Err(error) => {
return proc_macro::TokenStream::from(darling::Error::from(error).write_errors());
return proc_macro::TokenStream::from(error.write_errors());

Check warning on line 38 in crates/bitwarden-error-macro/src/attribute.rs

View check run for this annotation

Codecov / codecov/patch

crates/bitwarden-error-macro/src/attribute.rs#L37-L38

Added lines #L37 - L38 were not covered by tests
}
};

Expand Down
6 changes: 4 additions & 2 deletions crates/bitwarden-error-macro/src/basic/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub(crate) fn basic_error(item: proc_macro::TokenStream) -> proc_macro::TokenStr
let input = syn::parse_macro_input!(item as syn::DeriveInput);
let type_identifier = &input.ident;

let wasm = cfg!(feature = "wasm").then(|| basic_error_wasm(&type_identifier));
let wasm = cfg!(feature = "wasm").then(|| basic_error_wasm(type_identifier));
quote! {
#wasm
}
Expand All @@ -23,7 +23,9 @@ fn basic_error_wasm(type_identifier: &proc_macro2::Ident) -> proc_macro2::TokenS
export function {is_error_function_name}(error: any): error is {type_identifier};
"#"##
);
let ts_code: proc_macro2::TokenStream = ts_code_str.parse().unwrap();
let ts_code: proc_macro2::TokenStream = ts_code_str
.parse()
.expect("Could not generate TypeScript code");

quote! {
const _: () = {
Expand Down
6 changes: 4 additions & 2 deletions crates/bitwarden-error-macro/src/flat/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub(crate) fn flat_error(item: proc_macro::TokenStream) -> proc_macro::TokenStre
});

let wasm = cfg!(feature = "wasm")
.then(|| flat_error_wasm(&type_identifier, &variant_names.collect::<Vec<_>>()));
.then(|| flat_error_wasm(type_identifier, &variant_names.collect::<Vec<_>>()));

quote! {
#wasm
Expand Down Expand Up @@ -77,7 +77,9 @@ fn flat_error_wasm(
export function {is_error_function_name}(error: any): error is {type_identifier};
"#"##,
);
let ts_code: proc_macro2::TokenStream = ts_code_str.parse().unwrap();
let ts_code: proc_macro2::TokenStream = ts_code_str
.parse()
.expect("Could not generate TypeScript code");

quote! {
const _: () = {
Expand Down

0 comments on commit 60a5091

Please sign in to comment.