mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-11-10 06:34:18 +00:00
Clippy: Apply lints to lofty_attr
This commit is contained in:
parent
dcb08ca4c5
commit
0b627bcbca
4 changed files with 47 additions and 18 deletions
|
@ -1,5 +1,38 @@
|
|||
//! Macros for [Lofty](https://crates.io/crates/lofty)
|
||||
|
||||
#![allow(
|
||||
unknown_lints,
|
||||
clippy::too_many_lines,
|
||||
clippy::cast_precision_loss,
|
||||
clippy::cast_sign_loss,
|
||||
clippy::cast_possible_wrap,
|
||||
clippy::cast_possible_truncation,
|
||||
clippy::module_name_repetitions,
|
||||
clippy::must_use_candidate,
|
||||
clippy::doc_markdown,
|
||||
let_underscore_drop,
|
||||
clippy::match_wildcard_for_single_variants,
|
||||
clippy::semicolon_if_nothing_returned,
|
||||
clippy::new_without_default,
|
||||
clippy::from_over_into,
|
||||
clippy::upper_case_acronyms,
|
||||
clippy::single_match_else,
|
||||
clippy::similar_names,
|
||||
clippy::tabs_in_doc_comments,
|
||||
clippy::len_without_is_empty,
|
||||
clippy::needless_late_init,
|
||||
clippy::type_complexity,
|
||||
clippy::type_repetition_in_bounds,
|
||||
unused_qualifications,
|
||||
clippy::return_self_not_must_use,
|
||||
clippy::bool_to_int_with_if,
|
||||
clippy::uninlined_format_args, /* This should be changed for any normal "{}", but I'm not a fan of it for any debug or width specific formatting */
|
||||
clippy::manual_let_else,
|
||||
clippy::struct_excessive_bools,
|
||||
clippy::match_bool,
|
||||
clippy::needless_pass_by_value
|
||||
)]
|
||||
|
||||
mod internal;
|
||||
mod lofty_file;
|
||||
mod lofty_tag;
|
||||
|
|
|
@ -319,10 +319,10 @@ fn generate_audiofile_impl(
|
|||
read_fn: proc_macro2::TokenStream,
|
||||
write_fn: proc_macro2::TokenStream,
|
||||
) -> proc_macro2::TokenStream {
|
||||
let save_to_body = get_save_to_body(write_fn, &tag_fields);
|
||||
let save_to_body = get_save_to_body(write_fn, tag_fields);
|
||||
|
||||
let tag_exists = tag_exists_iter(&tag_fields);
|
||||
let tag_exists_2 = tag_exists_iter(&tag_fields);
|
||||
let tag_exists = tag_exists_iter(tag_fields);
|
||||
let tag_exists_2 = tag_exists_iter(tag_fields);
|
||||
|
||||
let tag_type = tag_fields.iter().map(|f| &f.tag_type);
|
||||
|
||||
|
|
|
@ -29,13 +29,13 @@ pub(crate) fn parse(
|
|||
if let Lit::Str(s) = &mnv.lit {
|
||||
desc = Some(s.value());
|
||||
continue;
|
||||
} else {
|
||||
bail!(
|
||||
errors,
|
||||
Span::call_site(),
|
||||
"Invalid `description` entry, expected string value"
|
||||
);
|
||||
}
|
||||
|
||||
bail!(
|
||||
errors,
|
||||
Span::call_site(),
|
||||
"Invalid `description` entry, expected string value"
|
||||
);
|
||||
},
|
||||
NestedMeta::Meta(Meta::List(list)) if list.path.is_ident("supported_formats") => {
|
||||
for nested in list.nested {
|
||||
|
|
|
@ -68,15 +68,11 @@ pub(crate) fn extract_type_from_option(ty: &Type) -> Option<Type> {
|
|||
}
|
||||
|
||||
fn extract_option_segment(path: &Path) -> Option<&PathSegment> {
|
||||
let idents_of_path = path
|
||||
.segments
|
||||
.iter()
|
||||
.into_iter()
|
||||
.fold(String::new(), |mut acc, v| {
|
||||
acc.push_str(&v.ident.to_string());
|
||||
acc.push('|');
|
||||
acc
|
||||
});
|
||||
let idents_of_path = path.segments.iter().fold(String::new(), |mut acc, v| {
|
||||
acc.push_str(&v.ident.to_string());
|
||||
acc.push('|');
|
||||
acc
|
||||
});
|
||||
vec!["Option|", "std|option|Option|", "core|option|Option|"]
|
||||
.into_iter()
|
||||
.find(|s| idents_of_path == *s)
|
||||
|
|
Loading…
Reference in a new issue