mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-11-10 06:34:18 +00:00
parent
95476dccd9
commit
a1f5c341f9
10 changed files with 68 additions and 62 deletions
48
Cargo.toml
48
Cargo.toml
|
@ -9,5 +9,53 @@ members = [
|
|||
[workspace.dependencies]
|
||||
byteorder = "1.5.0"
|
||||
|
||||
[workspace.lints.rust]
|
||||
missing_docs = "deny"
|
||||
rust_2018_idioms = "deny"
|
||||
trivial_casts = "deny"
|
||||
trivial_numeric_casts = "deny"
|
||||
unused_import_braces = "deny"
|
||||
explicit_outlives_requirements = "deny"
|
||||
unknown_lints = "allow"
|
||||
|
||||
[workspace.lints.clippy]
|
||||
dbg_macro = "forbid"
|
||||
string_to_string = "forbid"
|
||||
pedantic = { level = "deny", priority = -1 }
|
||||
all = { level = "deny", priority = -1 }
|
||||
too_many_lines = "allow"
|
||||
cast_precision_loss = "allow"
|
||||
cast_sign_loss = "allow"
|
||||
cast_possible_wrap = "allow"
|
||||
cast_possible_truncation = "allow"
|
||||
module_name_repetitions = "allow"
|
||||
must_use_candidate = "allow"
|
||||
doc_markdown = "allow"
|
||||
match_wildcard_for_single_variants = "allow"
|
||||
semicolon_if_nothing_returned = "allow"
|
||||
from_over_into = "allow"
|
||||
upper_case_acronyms = "allow"
|
||||
single_match_else = "allow"
|
||||
similar_names = "allow"
|
||||
tabs_in_doc_comments = "allow"
|
||||
len_without_is_empty = "allow"
|
||||
needless_late_init = "allow"
|
||||
type_complexity = "allow"
|
||||
return_self_not_must_use = "allow"
|
||||
bool_to_int_with_if = "allow"
|
||||
uninlined_format_args = "allow" # This should be changed for any normal "{}", but I'm not a fan of it for any debug or width specific formatting
|
||||
let_underscore_untyped = "allow"
|
||||
field_reassign_with_default = "allow"
|
||||
manual_range_patterns = "allow" # This is not at all clearer as it suggests
|
||||
no_effect_underscore_binding = "allow"
|
||||
used_underscore_binding = "allow"
|
||||
ignored_unit_patterns = "allow" # Not a fan of this lint, doesn't make anything clearer as it claims
|
||||
needless_return = "allow" # Explicit returns are needed from time to time for clarity
|
||||
redundant_guards = "allow" # Currently broken for some cases, might enable later
|
||||
into_iter_without_iter = "allow" # This is only going to fire on some internal types, doesn't matter much
|
||||
|
||||
[workspace.lints.rustdoc]
|
||||
broken_intra_doc_links = "deny"
|
||||
|
||||
[profile.bench]
|
||||
debug = true
|
||||
|
|
|
@ -38,6 +38,9 @@ structopt = { version = "0.3.26", default-features = false }
|
|||
tempfile = "3.10.1"
|
||||
iai-callgrind = "0.10.2"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[lib]
|
||||
bench = false
|
||||
|
||||
|
|
|
@ -99,51 +99,6 @@
|
|||
//!
|
||||
//! All formats have their own quirks that may produce unexpected results between conversions.
|
||||
//! Be sure to read the module documentation of each format to see important notes and warnings.
|
||||
#![forbid(clippy::dbg_macro, clippy::string_to_string)]
|
||||
#![deny(
|
||||
clippy::pedantic,
|
||||
clippy::all,
|
||||
missing_docs,
|
||||
rustdoc::broken_intra_doc_links,
|
||||
rust_2018_idioms,
|
||||
trivial_casts,
|
||||
trivial_numeric_casts,
|
||||
unused_import_braces,
|
||||
explicit_outlives_requirements
|
||||
)]
|
||||
#![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,
|
||||
clippy::match_wildcard_for_single_variants,
|
||||
clippy::semicolon_if_nothing_returned,
|
||||
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::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::let_underscore_untyped,
|
||||
clippy::field_reassign_with_default,
|
||||
clippy::manual_range_patterns, /* This is not at all clearer as it suggests */
|
||||
clippy::no_effect_underscore_binding,
|
||||
clippy::used_underscore_binding,
|
||||
clippy::ignored_unit_patterns, /* Not a fan of this lint, doesn't make anything clearer as it claims */
|
||||
clippy::needless_return, /* Explicit returns are needed from time to time for clarity */
|
||||
clippy::redundant_guards, /* Currently broken for some cases, might enable later*/
|
||||
clippy::into_iter_without_iter, /* This is only going to fire on some internal types, doesn't matter much */
|
||||
)]
|
||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||
#![doc(html_logo_url = "https://raw.githubusercontent.com/Serial-ATA/lofty-rs/main/doc/lofty.svg")]
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ const FULL_ATOM_SIZE: u64 = ATOM_HEADER_LEN + 4;
|
|||
const HDLR_SIZE: u64 = ATOM_HEADER_LEN + 25;
|
||||
|
||||
// TODO: We are forcing the use of ParseOptions::DEFAULT_PARSING_MODE. This is not good. It should be caller-specified.
|
||||
pub(crate) fn write_to<'a, F, I: 'a>(
|
||||
pub(crate) fn write_to<'a, F, I>(
|
||||
file: &mut F,
|
||||
tag: &mut IlstRef<'a, I>,
|
||||
write_options: WriteOptions,
|
||||
|
@ -29,7 +29,7 @@ where
|
|||
F: FileLike,
|
||||
LoftyError: From<<F as Truncate>::Error>,
|
||||
LoftyError: From<<F as Length>::Error>,
|
||||
I: IntoIterator<Item = &'a AtomData>,
|
||||
I: IntoIterator<Item = &'a AtomData> + 'a,
|
||||
{
|
||||
log::debug!("Attempting to write `ilst` tag to file");
|
||||
|
||||
|
@ -577,11 +577,9 @@ fn create_meta(writer: &AtomWriter, ilst: &[u8]) -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn build_ilst<'a, I: 'a>(
|
||||
atoms: &mut dyn Iterator<Item = AtomRef<'a, I>>,
|
||||
) -> Result<Vec<u8>>
|
||||
pub(super) fn build_ilst<'a, I>(atoms: &mut dyn Iterator<Item = AtomRef<'a, I>>) -> Result<Vec<u8>>
|
||||
where
|
||||
I: IntoIterator<Item = &'a AtomData>,
|
||||
I: IntoIterator<Item = &'a AtomData> + 'a,
|
||||
{
|
||||
log::debug!("Building `ilst` atom");
|
||||
|
||||
|
@ -656,9 +654,9 @@ where
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn write_atom_data<'a, I: 'a>(data: I, writer: &mut AtomWriterCompanion<'_>) -> Result<()>
|
||||
fn write_atom_data<'a, I>(data: I, writer: &mut AtomWriterCompanion<'_>) -> Result<()>
|
||||
where
|
||||
I: IntoIterator<Item = &'a AtomData>,
|
||||
I: IntoIterator<Item = &'a AtomData> + 'a,
|
||||
{
|
||||
for value in data {
|
||||
match value {
|
||||
|
|
|
@ -14,5 +14,8 @@ syn = { version = "2.0.25", features = ["full", "parsing"] }
|
|||
quote = "1.0.29"
|
||||
proc-macro2 = "1.0.64"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
|
|
@ -52,7 +52,7 @@ pub struct LoftyFile {
|
|||
}
|
||||
|
||||
impl Parse for LoftyFile {
|
||||
fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> {
|
||||
fn parse(input: syn::parse::ParseStream<'_>) -> syn::Result<Self> {
|
||||
let input: DeriveInput = input.parse()?;
|
||||
|
||||
let data_struct = match input.data {
|
||||
|
|
|
@ -101,7 +101,7 @@ pub(crate) struct LoftyTagAttribute {
|
|||
}
|
||||
|
||||
impl Parse for LoftyTagAttribute {
|
||||
fn parse(input: ParseStream) -> Result<Self> {
|
||||
fn parse(input: ParseStream<'_>) -> Result<Self> {
|
||||
let mut description = None;
|
||||
let mut supported_formats = Vec::new();
|
||||
|
||||
|
|
|
@ -12,3 +12,6 @@ include = ["src", "Cargo.toml", "../LICENSE-*"]
|
|||
|
||||
[dependencies]
|
||||
byteorder = "1.5.0"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
@ -4,6 +4,7 @@ use std::io::{Read, Seek};
|
|||
|
||||
use byteorder::{LittleEndian, ReadBytesExt};
|
||||
|
||||
/// The size of an OGG page header
|
||||
pub const PAGE_HEADER_SIZE: usize = 27;
|
||||
|
||||
/// An OGG page header
|
||||
|
|
|
@ -138,14 +138,9 @@ struct PaginateContextFlags {
|
|||
///
|
||||
/// let pages = paginate(&comment_header_packet, stream_serial_number, 0, 0);
|
||||
/// ```
|
||||
pub fn paginate<'a, I: 'a>(
|
||||
packets: I,
|
||||
stream_serial: u32,
|
||||
abgp: u64,
|
||||
flags: u8,
|
||||
) -> Result<Vec<Page>>
|
||||
pub fn paginate<'a, I>(packets: I, stream_serial: u32, abgp: u64, flags: u8) -> Result<Vec<Page>>
|
||||
where
|
||||
I: IntoIterator<Item = &'a [u8]>,
|
||||
I: IntoIterator<Item = &'a [u8]> + 'a,
|
||||
{
|
||||
let mut ctx = PaginateContext::new(abgp, stream_serial, flags);
|
||||
|
||||
|
|
Loading…
Reference in a new issue