Skip to content

Commit a502601

Browse files
uklotzdeSerial-ATA
authored andcommitted
Reformat code
1 parent 2734d7e commit a502601

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+213
-189
lines changed

benches/create_tag.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ bench_tag_write!([
6767
);
6868
}),
6969
(id3v2, Id3v2Tag, |tag| {
70-
use lofty::id3::v2::{Frame, TextInformationFrame};
7170
use lofty::TextEncoding;
71+
use lofty::id3::v2::{Frame, TextInformationFrame};
7272

7373
let picture = Picture::new_unchecked(
7474
PictureType::CoverFront,

lofty/src/aac/read.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
use super::header::{ADTSHeader, HEADER_MASK};
21
use super::AacFile;
2+
use super::header::{ADTSHeader, HEADER_MASK};
33
use crate::config::{ParseOptions, ParsingMode};
44
use crate::error::Result;
55
use crate::id3::v2::header::Id3v2Header;
66
use crate::id3::v2::read::parse_id3v2;
7-
use crate::id3::{find_id3v1, ID3FindResults};
7+
use crate::id3::{ID3FindResults, find_id3v1};
88
use crate::macros::{decode_err, err, parse_mode_choice};
9-
use crate::mpeg::header::{cmp_header, search_for_frame_sync, HeaderCmpResult};
9+
use crate::mpeg::header::{HeaderCmpResult, cmp_header, search_for_frame_sync};
1010

1111
use std::io::{Read, Seek, SeekFrom};
1212

@@ -180,7 +180,7 @@ where
180180
return Ok(Some((
181181
first_header,
182182
first_adts_frame_start_absolute + u64::from(header_len),
183-
)))
183+
)));
184184
},
185185
HeaderCmpResult::Undetermined => return Ok(None),
186186
HeaderCmpResult::NotEqual => {},

lofty/src/ape/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ use lofty_attr::LoftyFile;
2020

2121
pub use crate::picture::APE_PICTURE_TYPES;
2222
pub use properties::ApeProperties;
23-
pub use tag::item::ApeItem;
2423
pub use tag::ApeTag;
24+
pub use tag::item::ApeItem;
2525

2626
/// An APE file
2727
#[derive(LoftyFile)]

lofty/src/ape/read.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::error::Result;
77
use crate::id3::v1::tag::Id3v1Tag;
88
use crate::id3::v2::read::parse_id3v2;
99
use crate::id3::v2::tag::Id3v2Tag;
10-
use crate::id3::{find_id3v1, find_id3v2, find_lyrics3v2, FindId3v2Config, ID3FindResults};
10+
use crate::id3::{FindId3v2Config, ID3FindResults, find_id3v1, find_id3v2, find_lyrics3v2};
1111
use crate::macros::{decode_err, err};
1212

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

lofty/src/ape/tag/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ mod write;
55
use crate::ape::tag::item::{ApeItem, ApeItemRef};
66
use crate::config::WriteOptions;
77
use crate::error::{LoftyError, Result};
8-
use crate::id3::v2::util::pairs::{format_number_pair, set_number, NUMBER_PAIR_KEYS};
8+
use crate::id3::v2::util::pairs::{NUMBER_PAIR_KEYS, format_number_pair, set_number};
99
use crate::tag::item::ItemValueRef;
1010
use crate::tag::{
11-
try_parse_year, Accessor, ItemKey, ItemValue, MergeTag, SplitTag, Tag, TagExt, TagItem, TagType,
11+
Accessor, ItemKey, ItemValue, MergeTag, SplitTag, Tag, TagExt, TagItem, TagType, try_parse_year,
1212
};
1313
use crate::util::flag_item;
1414
use crate::util::io::{FileLike, Truncate};

lofty/src/ape/tag/read.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use super::item::ApeItem;
21
use super::ApeTag;
2+
use super::item::ApeItem;
3+
use crate::ape::APE_PICTURE_TYPES;
34
use crate::ape::constants::{APE_PREAMBLE, INVALID_KEYS};
45
use crate::ape::header::{self, ApeHeader};
5-
use crate::ape::APE_PICTURE_TYPES;
66
use crate::config::ParseOptions;
77
use crate::error::Result;
88
use crate::macros::{decode_err, err, try_vec};

lofty/src/ape/tag/write.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
use super::item::ApeItemRef;
21
use super::ApeTagRef;
2+
use super::item::ApeItemRef;
33
use crate::ape::constants::APE_PREAMBLE;
44
use crate::ape::tag::read;
55
use crate::config::{ParseOptions, WriteOptions};
66
use crate::error::{LoftyError, Result};
7-
use crate::id3::{find_id3v1, find_id3v2, find_lyrics3v2, FindId3v2Config};
7+
use crate::id3::{FindId3v2Config, find_id3v1, find_id3v2, find_lyrics3v2};
88
use crate::macros::{decode_err, err};
99
use crate::probe::Probe;
1010
use crate::tag::item::ItemValueRef;
@@ -134,7 +134,7 @@ where
134134

135135
// Now, if there was a tag at the beginning, remove it
136136
if header_ape_tag.0 {
137-
file_bytes.drain(header_ape_tag.1 .0 as usize..header_ape_tag.1 .1 as usize);
137+
file_bytes.drain(header_ape_tag.1.0 as usize..header_ape_tag.1.1 as usize);
138138
}
139139

140140
file.rewind()?;

lofty/src/config/global_options.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub(crate) unsafe fn global_options() -> &'static GlobalOptions {
1313
/// # Examples
1414
///
1515
/// ```rust
16-
/// use lofty::config::{apply_global_options, GlobalOptions};
16+
/// use lofty::config::{GlobalOptions, apply_global_options};
1717
///
1818
/// // I have a custom resolver that I need checked
1919
/// let global_options = GlobalOptions::new().use_custom_resolvers(true);
@@ -58,7 +58,7 @@ impl GlobalOptions {
5858
/// # Examples
5959
///
6060
/// ```rust
61-
/// use lofty::config::{apply_global_options, GlobalOptions};
61+
/// use lofty::config::{GlobalOptions, apply_global_options};
6262
///
6363
/// // By default, `use_custom_resolvers` is enabled. Here, we don't want to use them.
6464
/// let global_options = GlobalOptions::new().use_custom_resolvers(false);
@@ -77,7 +77,7 @@ impl GlobalOptions {
7777
/// # Examples
7878
///
7979
/// ```rust
80-
/// use lofty::config::{apply_global_options, GlobalOptions};
80+
/// use lofty::config::{GlobalOptions, apply_global_options};
8181
///
8282
/// // I have files with gigantic images, I'll double the allocation limit!
8383
/// let global_options = GlobalOptions::new().allocation_limit(32 * 1024 * 1024);
@@ -100,7 +100,7 @@ impl GlobalOptions {
100100
/// # Examples
101101
///
102102
/// ```rust
103-
/// use lofty::config::{apply_global_options, GlobalOptions};
103+
/// use lofty::config::{GlobalOptions, apply_global_options};
104104
///
105105
/// // I'm just reading tags, I don't need to preserve format-specific items
106106
/// let global_options = GlobalOptions::new().preserve_format_specific_items(false);
@@ -136,7 +136,7 @@ impl Default for GlobalOptions {
136136
/// # Examples
137137
///
138138
/// ```rust
139-
/// use lofty::config::{apply_global_options, GlobalOptions};
139+
/// use lofty::config::{GlobalOptions, apply_global_options};
140140
///
141141
/// // I have a custom resolver that I need checked
142142
/// let global_options = GlobalOptions::new().use_custom_resolvers(true);

lofty/src/config/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ mod global_options;
44
mod parse_options;
55
mod write_options;
66

7-
pub use global_options::{apply_global_options, GlobalOptions};
7+
pub use global_options::{GlobalOptions, apply_global_options};
88
pub use parse_options::{ParseOptions, ParsingMode};
99
pub use write_options::WriteOptions;
1010

lofty/src/flac/read.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
use super::FlacFile;
12
use super::block::Block;
23
use super::properties::FlacProperties;
3-
use super::FlacFile;
44
use crate::config::{ParseOptions, ParsingMode};
55
use crate::error::Result;
66
use crate::flac::block::{BLOCK_ID_PICTURE, BLOCK_ID_STREAMINFO, BLOCK_ID_VORBIS_COMMENTS};
77
use crate::id3::v2::read::parse_id3v2;
8-
use crate::id3::{find_id3v2, FindId3v2Config, ID3FindResults};
8+
use crate::id3::{FindId3v2Config, ID3FindResults, find_id3v2};
99
use crate::macros::{decode_err, err};
1010
use crate::ogg::read::read_comments;
1111
use crate::picture::Picture;

lofty/src/flac/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use super::block::{Block, BLOCK_ID_PADDING, BLOCK_ID_PICTURE, BLOCK_ID_VORBIS_COMMENTS};
1+
use super::block::{BLOCK_ID_PADDING, BLOCK_ID_PICTURE, BLOCK_ID_VORBIS_COMMENTS, Block};
22
use super::read::verify_flac;
33
use crate::config::WriteOptions;
44
use crate::error::{LoftyError, Result};

lofty/src/id3/v1/read.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,5 @@ fn decode_text(data: &[u8]) -> Option<String> {
4646
.map(|c| *c as char)
4747
.collect::<String>();
4848

49-
if read.is_empty() {
50-
None
51-
} else {
52-
Some(read)
53-
}
49+
if read.is_empty() { None } else { Some(read) }
5450
}

lofty/src/id3/v1/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::tag::Id3v1TagRef;
22
use crate::config::WriteOptions;
33
use crate::error::{LoftyError, Result};
4-
use crate::id3::{find_id3v1, ID3FindResults};
4+
use crate::id3::{ID3FindResults, find_id3v1};
55
use crate::macros::err;
66
use crate::probe::Probe;
77
use crate::util::io::{FileLike, Length, Truncate};

lofty/src/id3/v2/frame/conversion.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
use crate::TextEncoding;
12
use crate::error::{Id3v2Error, Id3v2ErrorKind, LoftyError, Result};
2-
use crate::id3::v2::frame::{FrameRef, EMPTY_CONTENT_DESCRIPTOR, MUSICBRAINZ_UFID_OWNER};
3+
use crate::id3::v2::frame::{EMPTY_CONTENT_DESCRIPTOR, FrameRef, MUSICBRAINZ_UFID_OWNER};
34
use crate::id3::v2::tag::{
45
new_binary_frame, new_comment_frame, new_text_frame, new_unsync_text_frame, new_url_frame,
56
new_user_text_frame, new_user_url_frame,
@@ -10,7 +11,6 @@ use crate::id3::v2::{
1011
};
1112
use crate::macros::err;
1213
use crate::tag::{ItemKey, ItemValue, TagItem, TagType};
13-
use crate::TextEncoding;
1414

1515
use std::borrow::Cow;
1616

@@ -132,7 +132,7 @@ impl<'a> TryFrom<&'a TagItem> for FrameRef<'a> {
132132
return Err(Id3v2Error::new(Id3v2ErrorKind::UnsupportedFrameId(
133133
item_key.clone(),
134134
))
135-
.into())
135+
.into());
136136
},
137137
}
138138
},

lofty/src/id3/v2/frame/header/parse.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use super::FrameFlags;
22
use crate::error::{Id3v2Error, Id3v2ErrorKind, Result};
3+
use crate::id3::v2::FrameId;
34
use crate::id3::v2::util::synchsafe::SynchsafeInteger;
45
use crate::id3::v2::util::upgrade::{upgrade_v2, upgrade_v3};
5-
use crate::id3::v2::FrameId;
66
use crate::util::text::utf8_decode_str;
77

88
use crate::config::ParseOptions;

lofty/src/id3/v2/frame/read.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use super::header::parse::{parse_header, parse_v2_header};
21
use super::Frame;
2+
use super::header::parse::{parse_header, parse_v2_header};
33
use crate::config::{ParseOptions, ParsingMode};
44
use crate::error::{Id3v2Error, Id3v2ErrorKind, Result};
55
use crate::id3::v2::frame::content::parse_content;

lofty/src/id3/v2/header.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl Id3v2Header {
111111
major => {
112112
return Err(
113113
Id3v2Error::new(Id3v2ErrorKind::BadId3v2Version(major, header[4])).into(),
114-
)
114+
);
115115
},
116116
};
117117

lofty/src/id3/v2/items/attached_picture_frame.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::id3::v2::header::Id3v2Version;
33
use crate::id3::v2::{FrameFlags, FrameHeader, FrameId};
44
use crate::macros::err;
55
use crate::picture::{MimeType, Picture, PictureType};
6-
use crate::util::text::{encode_text, TextDecodeOptions, TextEncoding};
6+
use crate::util::text::{TextDecodeOptions, TextEncoding, encode_text};
77

88
use std::borrow::Cow;
99
use std::io::{Read, Write as _};
@@ -82,7 +82,7 @@ impl AttachedPictureFrame<'_> {
8282
return Err(Id3v2Error::new(Id3v2ErrorKind::BadPictureFormat(
8383
String::from_utf8_lossy(&format).into_owned(),
8484
))
85-
.into())
85+
.into());
8686
},
8787
}
8888
} else {

lofty/src/id3/v2/items/audio_text_frame.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::error::{ErrorKind, Id3v2Error, Id3v2ErrorKind, LoftyError, Result};
22
use crate::id3::v2::{FrameFlags, FrameHeader, FrameId};
3-
use crate::util::text::{decode_text, encode_text, TextDecodeOptions, TextEncoding};
3+
use crate::util::text::{TextDecodeOptions, TextEncoding, decode_text, encode_text};
44

55
use std::borrow::Cow;
66
use std::hash::{Hash, Hasher};
@@ -234,8 +234,8 @@ pub fn scramble(audio_data: &mut [u8]) {
234234

235235
#[cfg(test)]
236236
mod tests {
237-
use crate::id3::v2::{AudioTextFrame, AudioTextFrameFlags, FrameFlags};
238237
use crate::TextEncoding;
238+
use crate::id3::v2::{AudioTextFrame, AudioTextFrameFlags, FrameFlags};
239239

240240
fn expected() -> AudioTextFrame<'static> {
241241
AudioTextFrame {

lofty/src/id3/v2/items/encapsulated_object.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::error::{ErrorKind, Id3v2Error, Id3v2ErrorKind, LoftyError, Result};
22
use crate::id3::v2::{FrameFlags, FrameHeader, FrameId};
3-
use crate::util::text::{decode_text, encode_text, TextDecodeOptions, TextEncoding};
3+
use crate::util::text::{TextDecodeOptions, TextEncoding, decode_text, encode_text};
44

55
use std::io::{Cursor, Read};
66

lofty/src/id3/v2/items/extended_text_frame.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::id3::v2::header::Id3v2Version;
44
use crate::id3::v2::{FrameFlags, FrameHeader, FrameId};
55
use crate::macros::err;
66
use crate::util::text::{
7-
decode_text, encode_text, utf16_decode_bytes, TextDecodeOptions, TextEncoding,
7+
TextDecodeOptions, TextEncoding, decode_text, encode_text, utf16_decode_bytes,
88
};
99

1010
use std::borrow::Cow;

lofty/src/id3/v2/items/extended_url_frame.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::error::Result;
22
use crate::id3::v2::frame::content::verify_encoding;
33
use crate::id3::v2::header::Id3v2Version;
44
use crate::id3::v2::{FrameFlags, FrameHeader, FrameId};
5-
use crate::util::text::{decode_text, encode_text, TextDecodeOptions, TextEncoding};
5+
use crate::util::text::{TextDecodeOptions, TextEncoding, decode_text, encode_text};
66

77
use std::borrow::Cow;
88
use std::hash::{Hash, Hasher};

lofty/src/id3/v2/items/key_value_frame.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::error::Result;
22
use crate::id3::v2::frame::content::verify_encoding;
33
use crate::id3::v2::header::Id3v2Version;
44
use crate::id3::v2::{FrameFlags, FrameHeader, FrameId};
5-
use crate::util::text::{decode_text, encode_text, TextDecodeOptions, TextEncoding};
5+
use crate::util::text::{TextDecodeOptions, TextEncoding, decode_text, encode_text};
66

77
use byteorder::ReadBytesExt;
88

lofty/src/id3/v2/items/language_frame.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::id3::v2::frame::content::verify_encoding;
33
use crate::id3::v2::header::Id3v2Version;
44
use crate::id3::v2::{FrameFlags, FrameHeader, FrameId};
55
use crate::tag::items::Lang;
6-
use crate::util::text::{decode_text, encode_text, TextDecodeOptions, TextEncoding};
6+
use crate::util::text::{TextDecodeOptions, TextEncoding, decode_text, encode_text};
77

88
use std::borrow::Cow;
99
use std::hash::{Hash, Hasher};

lofty/src/id3/v2/items/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ mod unique_file_identifier;
1818
mod url_link_frame;
1919

2020
pub use attached_picture_frame::AttachedPictureFrame;
21-
pub use audio_text_frame::{scramble, AudioTextFrame, AudioTextFrameFlags};
21+
pub use audio_text_frame::{AudioTextFrame, AudioTextFrameFlags, scramble};
2222
pub use binary_frame::BinaryFrame;
2323
pub use encapsulated_object::GeneralEncapsulatedObject;
2424
pub use event_timing_codes_frame::{Event, EventTimingCodesFrame, EventType};

lofty/src/id3/v2/items/ownership_frame.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::error::{ErrorKind, Id3v2Error, Id3v2ErrorKind, LoftyError, Result};
22
use crate::id3::v2::{FrameFlags, FrameHeader, FrameId};
33
use crate::util::text::{
4-
decode_text, encode_text, utf8_decode_str, TextDecodeOptions, TextEncoding,
4+
TextDecodeOptions, TextEncoding, decode_text, encode_text, utf8_decode_str,
55
};
66

77
use std::borrow::Cow;
@@ -138,8 +138,8 @@ impl OwnershipFrame<'_> {
138138

139139
#[cfg(test)]
140140
mod tests {
141-
use crate::id3::v2::{FrameFlags, FrameHeader, FrameId, OwnershipFrame};
142141
use crate::TextEncoding;
142+
use crate::id3::v2::{FrameFlags, FrameHeader, FrameId, OwnershipFrame};
143143

144144
use std::borrow::Cow;
145145

lofty/src/id3/v2/items/popularimeter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::error::Result;
22
use crate::id3::v2::{FrameFlags, FrameHeader, FrameId};
33
use crate::util::alloc::VecFallibleCapacity;
4-
use crate::util::text::{decode_text, encode_text, TextDecodeOptions, TextEncoding};
4+
use crate::util::text::{TextDecodeOptions, TextEncoding, decode_text, encode_text};
55

66
use std::borrow::Cow;
77
use std::hash::{Hash, Hasher};

lofty/src/id3/v2/items/private_frame.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::error::Result;
22
use crate::id3::v2::{FrameFlags, FrameHeader, FrameId};
33
use crate::util::alloc::VecFallibleCapacity;
4-
use crate::util::text::{decode_text, encode_text, TextDecodeOptions, TextEncoding};
4+
use crate::util::text::{TextDecodeOptions, TextEncoding, decode_text, encode_text};
55

66
use std::borrow::Cow;
77
use std::io::Read;

lofty/src/id3/v2/items/relative_volume_adjustment_frame.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::config::ParsingMode;
22
use crate::error::{Id3v2Error, Id3v2ErrorKind, Result};
33
use crate::id3::v2::{FrameFlags, FrameHeader, FrameId};
44
use crate::macros::try_vec;
5-
use crate::util::text::{decode_text, encode_text, TextDecodeOptions, TextEncoding};
5+
use crate::util::text::{TextDecodeOptions, TextEncoding, decode_text, encode_text};
66

77
use std::borrow::Cow;
88
use std::collections::HashMap;

lofty/src/id3/v2/items/sync_text.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use crate::error::{ErrorKind, Id3v2Error, Id3v2ErrorKind, LoftyError, Result};
22
use crate::id3::v2::{FrameFlags, FrameHeader, FrameId};
33
use crate::macros::err;
44
use crate::util::text::{
5-
decode_text, encode_text, read_to_terminator, utf16_decode_bytes, TextDecodeOptions,
6-
TextEncoding,
5+
TextDecodeOptions, TextEncoding, decode_text, encode_text, read_to_terminator,
6+
utf16_decode_bytes,
77
};
88

99
use std::borrow::Cow;

lofty/src/id3/v2/items/text_information_frame.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::error::Result;
22
use crate::id3::v2::frame::content::verify_encoding;
33
use crate::id3::v2::header::Id3v2Version;
44
use crate::id3::v2::{FrameFlags, FrameHeader, FrameId};
5-
use crate::util::text::{decode_text, encode_text, TextDecodeOptions, TextEncoding};
5+
use crate::util::text::{TextDecodeOptions, TextEncoding, decode_text, encode_text};
66

77
use byteorder::ReadBytesExt;
88

0 commit comments

Comments
 (0)