Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: don't warn on useless conversions when the count value is already a usize #206

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions binrw_derive/src/binrw/codegen/mod.rs
Expand Up @@ -325,6 +325,7 @@ fn directives_to_args(field: &StructField, stream: IdentStr) -> TokenStream {
quote_spanned_any! {count.span()=>
count: {
let #TEMP = #count;
#[allow(clippy::useless_conversion)]
usize::try_from(#TEMP).map_err(|_| {
extern crate alloc;
#BIN_ERROR::AssertFail {
Expand Down
2 changes: 1 addition & 1 deletion binrw_derive/src/binrw/codegen/sanitization.rs
@@ -1,4 +1,4 @@
///! Utilities for helping sanitize macro
//! Utilities for helping sanitize macro
use crate::util::{from_crate, ident_str};
use proc_macro2::Ident;
use quote::format_ident;
Expand Down