Skip to content

Commit 8746e25

Browse files
committed
misc: fmt
1 parent aa08344 commit 8746e25

33 files changed

+65
-67
lines changed

aud_io/src/alloc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use crate::error::Result;
2-
use crate::err;
31
use crate::config::global_options;
2+
use crate::err;
3+
use crate::error::Result;
44

55
/// Provides the `fallible_repeat` method on [`Vec`]
66
///

aud_io/src/config/global_options.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ pub(crate) unsafe fn global_options() -> &'static GlobalOptions {
1616
/// use aud_io::config::{GlobalOptions, apply_global_options};
1717
///
1818
/// // I want to double the allocation limit
19-
/// let global_options = GlobalOptions::new().allocation_limit(GlobalOptions::DEFAULT_ALLOCATION_LIMIT * 2);
19+
/// let global_options =
20+
/// GlobalOptions::new().allocation_limit(GlobalOptions::DEFAULT_ALLOCATION_LIMIT * 2);
2021
/// apply_global_options(global_options);
2122
/// ```
2223
#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq)]
@@ -58,7 +59,8 @@ impl GlobalOptions {
5859
/// use aud_io::config::{GlobalOptions, apply_global_options};
5960
///
6061
/// // I have files with gigantic images, I'll double the allocation limit!
61-
/// let global_options = GlobalOptions::new().allocation_limit(GlobalOptions::DEFAULT_ALLOCATION_LIMIT * 2);
62+
/// let global_options =
63+
/// GlobalOptions::new().allocation_limit(GlobalOptions::DEFAULT_ALLOCATION_LIMIT * 2);
6264
/// apply_global_options(global_options);
6365
/// ```
6466
pub fn allocation_limit(&mut self, allocation_limit: usize) -> Self {
@@ -90,7 +92,8 @@ impl Default for GlobalOptions {
9092
/// use aud_io::config::{GlobalOptions, apply_global_options};
9193
///
9294
/// // I want to double the allocation limit
93-
/// let global_options = GlobalOptions::new().allocation_limit(GlobalOptions::DEFAULT_ALLOCATION_LIMIT * 2);
95+
/// let global_options =
96+
/// GlobalOptions::new().allocation_limit(GlobalOptions::DEFAULT_ALLOCATION_LIMIT * 2);
9497
/// apply_global_options(global_options);
9598
/// ```
9699
pub fn apply_global_options(options: GlobalOptions) {

aud_io/src/error.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub enum AudioError {
2121
// Format-specific
2222
/// Arises when an MP4 atom contains invalid data
2323
BadAtom(&'static str),
24-
24+
2525
// Conversions for external errors
2626
/// Represents all cases of [`std::io::Error`].
2727
Io(std::io::Error),
@@ -69,7 +69,7 @@ impl Display for AudioError {
6969
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
7070
match self {
7171
AudioError::TextDecode(message) => write!(f, "Text decoding: {message}"),
72-
72+
7373
// Conversions
7474
AudioError::StringFromUtf8(err) => write!(f, "{err}"),
7575
AudioError::StrFromUtf8(err) => write!(f, "{err}"),
@@ -86,7 +86,7 @@ impl Display for AudioError {
8686
f,
8787
"Encountered an invalid item size, either too big or too small to be valid"
8888
),
89-
89+
9090
// Format-specific
9191
AudioError::BadAtom(message) => write!(f, "MP4 Atom: {message}"),
9292
}

aud_io/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
pub mod text;
1+
pub mod alloc;
2+
pub mod config;
23
pub mod error;
4+
pub mod io;
35
pub(crate) mod macros;
46
pub mod math;
5-
pub mod io;
6-
pub mod config;
7-
pub mod alloc;
87
pub mod mp4;
8+
pub mod text;

aud_io/src/mp4/atom_info.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,10 @@ where
216216

217217
match atom {
218218
Some(AtomInfo {
219-
ident: AtomIdent::Fourcc(ref fourcc),
220-
len,
221-
..
222-
}) if fourcc == name => {
219+
ident: AtomIdent::Fourcc(ref fourcc),
220+
len,
221+
..
222+
}) if fourcc == name => {
223223
if len < 12 {
224224
err!(BadAtom("Found an incomplete freeform identifier chunk"));
225225
}
@@ -239,9 +239,7 @@ where
239239
*reader_size -= len;
240240

241241
utf8_decode(content).map_err(|_| {
242-
AudioError::BadAtom(
243-
"Found a non UTF-8 string while reading freeform identifier",
244-
)
242+
AudioError::BadAtom("Found a non UTF-8 string while reading freeform identifier")
245243
})
246244
},
247245
_ => err!(BadAtom(

aud_io/src/mp4/atom_reader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use crate::config::ParsingMode;
2-
use crate::error::Result;
31
use super::atom_info::AtomInfo;
2+
use crate::config::ParsingMode;
43
use crate::err;
4+
use crate::error::Result;
55
use crate::io::SeekStreamLen;
66

77
use std::io::{Read, Seek, SeekFrom};

aud_io/src/text.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use crate::error::{AudioError, Result};
21
use crate::err;
2+
use crate::error::{AudioError, Result};
33

44
use std::io::Read;
55

@@ -157,8 +157,9 @@ where
157157
}
158158
},
159159
TextEncoding::UTF16BE => utf16_decode_bytes(raw_bytes.as_slice(), u16::from_be_bytes)?,
160-
TextEncoding::UTF8 => utf8_decode(raw_bytes)
161-
.map_err(|_| AudioError::TextDecode("Expected a UTF-8 string"))?,
160+
TextEncoding::UTF8 => {
161+
utf8_decode(raw_bytes).map_err(|_| AudioError::TextDecode("Expected a UTF-8 string"))?
162+
},
162163
};
163164

164165
Ok(DecodeTextResult {
@@ -356,7 +357,7 @@ mod tests {
356357
],
357358
u16::from_be_bytes,
358359
)
359-
.unwrap();
360+
.unwrap();
360361

361362
assert_eq!(utf16_decode, TEST_STRING.to_string());
362363

@@ -367,14 +368,14 @@ mod tests {
367368
]),
368369
TextDecodeOptions::new().encoding(TextEncoding::UTF16),
369370
)
370-
.unwrap();
371+
.unwrap();
371372
let le_utf16_decode = super::decode_text(
372373
&mut Cursor::new(&[
373374
0xFF, 0xFE, 0x6C, 0x00, 0xF8, 0x00, 0x66, 0x00, 0x74, 0x00, 0xA5, 0x00, 0x00, 0x00,
374375
]),
375376
TextDecodeOptions::new().encoding(TextEncoding::UTF16),
376377
)
377-
.unwrap();
378+
.unwrap();
378379

379380
assert_eq!(be_utf16_decode.content, le_utf16_decode.content);
380381
assert_eq!(be_utf16_decode.bytes_read, le_utf16_decode.bytes_read);
@@ -384,7 +385,7 @@ mod tests {
384385
&mut TEST_STRING.as_bytes(),
385386
TextDecodeOptions::new().encoding(TextEncoding::UTF8),
386387
)
387-
.unwrap();
388+
.unwrap();
388389

389390
assert_eq!(utf8_decode.content, TEST_STRING.to_string());
390391
}

lofty/src/ape/tag/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ use crate::tag::item::ItemValueRef;
1111

1212
use std::io::{Cursor, Seek, SeekFrom, Write};
1313

14-
use aud_io::io::{FileLike, Truncate};
1514
use aud_io::err as io_err;
15+
use aud_io::io::{FileLike, Truncate};
1616
use byteorder::{LittleEndian, WriteBytesExt};
1717

1818
#[allow(clippy::shadow_unrelated)]

lofty/src/config/global_options.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ pub struct GlobalOptions {
2929

3030
impl GlobalOptions {
3131
/// Default allocation limit for any single tag item
32-
pub const DEFAULT_ALLOCATION_LIMIT: usize = aud_io::config::GlobalOptions::DEFAULT_ALLOCATION_LIMIT;
32+
pub const DEFAULT_ALLOCATION_LIMIT: usize =
33+
aud_io::config::GlobalOptions::DEFAULT_ALLOCATION_LIMIT;
3334

3435
/// Creates a new `GlobalOptions`, alias for `Default` implementation
3536
///

lofty/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use crate::tag::ItemKey;
99

1010
use std::fmt::{Debug, Display, Formatter};
1111

12-
use ogg_pager::PageError;
1312
use aud_io::error::AudioError;
13+
use ogg_pager::PageError;
1414

1515
/// Alias for `Result<T, LoftyError>`
1616
pub type Result<T> = std::result::Result<T, LoftyError>;

0 commit comments

Comments
 (0)