Skip to content

Commit 46f2d68

Browse files
committed
misc: Fix Clippy lints
1 parent 5663358 commit 46f2d68

File tree

18 files changed

+46
-41
lines changed

18 files changed

+46
-41
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ explicit_outlives_requirements = "deny"
3434
unknown_lints = "allow"
3535

3636
[workspace.lints.clippy]
37-
dbg_macro = "forbid"
38-
string_to_string = "forbid"
37+
dbg_macro = "deny"
3938
pedantic = { level = "deny", priority = -1 }
4039
all = { level = "deny", priority = -1 }
4140
too_many_lines = "allow"
@@ -72,6 +71,7 @@ struct_excessive_bools = "allow" # I have yet to find one case of this
7271
needless_continue = "allow" # All occurences of this lint are just for clarity in large loops
7372
unbuffered_bytes = "allow" # It is up to the caller to wrap their data in `BufReader`s
7473
struct_field_names = "allow"
74+
items_after_statements = "allow"
7575

7676
[workspace.lints.rustdoc]
7777
broken_intra_doc_links = "deny"

examples/custom_resolver/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ struct MyFile {
4444
}
4545

4646
impl MyFile {
47+
#[allow(clippy::unnecessary_wraps)]
4748
pub fn parse_my_file<R>(_reader: &mut R, _parse_options: ParseOptions) -> LoftyResult<Self>
4849
where
4950
R: std::io::Read + std::io::Seek,

lofty/src/ape/tag/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ mod tests {
923923

924924
#[test_log::test]
925925
fn skip_reading_cover_art() {
926-
let p = Picture::unchecked(std::iter::repeat(0).take(50).collect::<Vec<u8>>())
926+
let p = Picture::unchecked(std::iter::repeat_n(0, 50).collect::<Vec<u8>>())
927927
.pic_type(PictureType::CoverFront)
928928
.mime_type(MimeType::Jpeg)
929929
.build();

lofty/src/id3/v2/tag/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,7 @@ fn hold_back_4_character_txxx_description() {
12841284

12851285
#[test_log::test]
12861286
fn skip_reading_cover_art() {
1287-
let p = Picture::unchecked(std::iter::repeat(0).take(50).collect::<Vec<u8>>())
1287+
let p = Picture::unchecked(std::iter::repeat_n(0, 50).collect::<Vec<u8>>())
12881288
.pic_type(PictureType::CoverFront)
12891289
.mime_type(MimeType::Jpeg)
12901290
.build();

lofty/src/mp4/ilst/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,7 @@ mod tests {
14651465

14661466
#[test_log::test]
14671467
fn skip_reading_cover_art() {
1468-
let p = Picture::unchecked(std::iter::repeat(0).take(50).collect::<Vec<u8>>())
1468+
let p = Picture::unchecked(std::iter::repeat_n(0, 50).collect::<Vec<u8>>())
14691469
.pic_type(PictureType::CoverFront)
14701470
.mime_type(MimeType::Jpeg)
14711471
.build();

lofty/src/ogg/tag.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ mod tests {
896896

897897
#[test_log::test]
898898
fn skip_reading_cover_art() {
899-
let p = Picture::unchecked(std::iter::repeat(0).take(50).collect::<Vec<u8>>())
899+
let p = Picture::unchecked(std::iter::repeat_n(0, 50).collect::<Vec<u8>>())
900900
.pic_type(PictureType::CoverFront)
901901
.mime_type(MimeType::Jpeg)
902902
.build();

lofty/tests/files/util/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@ pub fn temp_file(path: impl AsRef<Path>) -> File {
2222
/// Copy `path` into a [`temp_file()`] and parse it via [`Probe`]
2323
pub fn read(path: impl AsRef<Path>) -> BoundTaggedFile<File> {
2424
let file = temp_file(path);
25-
let tagged_file = Probe::new(file)
25+
26+
Probe::new(file)
2627
.options(ParseOptions::new())
2728
.guess_file_type()
2829
.unwrap()
2930
.read_bound()
30-
.unwrap();
31-
32-
tagged_file
31+
.unwrap()
3332
}
3433

3534
/// Verify that the file at `path` has no tags

lofty/tests/taglib/test_apetag.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,14 @@ fn test_invalid_keys() {
8787
}
8888

8989
#[test_log::test]
90-
#[ignore]
90+
#[ignore = "Marker test, Lofty doesn't replicate this API"]
9191
fn test_text_binary() {
92-
// Marker test, this is useless as Lofty does not have a similar API that the test is based upon:
9392
// https://github.com/taglib/taglib/blob/a31356e330674640a07bef7d71d08242cae8e9bf/tests/test_apetag.cpp#L153
9493
}
9594

9695
// TODO: Does not work! We fall for this collision.
9796
#[test_log::test]
98-
#[ignore]
97+
#[ignore = "We currently fall for this collision"]
9998
fn test_id3v1_collision() {
10099
let mut file = temp_file!("tests/taglib/data/no-tags.mpc");
101100
{

lofty/tests/taglib/test_fileref.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ fn test_musepack() {
8686
file_ref_save("click.mpc", FileType::Mpc);
8787
}
8888

89+
// TODO: We don't support ASF yet
8990
#[test_log::test]
90-
#[ignore]
91+
#[ignore = "AFK is not supported yet"]
9192
fn test_asf() {
92-
// TODO: We don't support ASF yet
9393
// file_ref_save("silence-1.asf", FileType::ASF);
9494
}
9595

@@ -113,10 +113,10 @@ fn test_mp3() {
113113
file_ref_save("xing.mp3", FileType::Mpeg);
114114
}
115115

116+
// TODO: We don't support TTA yet
116117
#[test_log::test]
117-
#[ignore]
118+
#[ignore = "TTA is not supported yet"]
118119
fn test_true_audio() {
119-
// TODO: We don't support TTA yet
120120
// file_ref_save("empty.tta", FileType::TrueAudio);
121121
}
122122

@@ -145,8 +145,9 @@ fn test_wav() {
145145
file_ref_save("empty.wav", FileType::Wav);
146146
}
147147

148+
// TODO: We don't yet support FLAC in oga
148149
#[test_log::test]
149-
#[ignore] // TODO: We don't yet support FLAC in oga
150+
#[ignore = "FLAC in OGA isn't supported yet"]
150151
fn test_oga_flac() {
151152
file_ref_save("empty_flac.oga", FileType::Flac);
152153
}

lofty/tests/taglib/test_flac.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ fn test_repeated_save_2() {}
217217

218218
// TODO: We don't make use of padding blocks yet
219219
#[test_log::test]
220-
#[ignore]
220+
#[ignore = "FLAC padding blocks aren't used yet"]
221221
fn test_repeated_save_3() {
222222
let mut file = temp_file!("tests/taglib/data/no-tags.flac");
223223

@@ -425,7 +425,7 @@ fn test_zero_sized_padding_2() {
425425

426426
// TODO: We don't make use of padding blocks yet
427427
#[test_log::test]
428-
#[ignore]
428+
#[ignore = "FLAC padding blocks aren't used yet"]
429429
fn test_shrink_padding() {
430430
let mut file = temp_file!("tests/taglib/data/silence-44-s.flac");
431431
{
@@ -480,7 +480,7 @@ fn test_empty_id3v2() {
480480

481481
// TODO: TagLib doesn't fully remove Vorbis Comments when stripping. It will preserve the vendor string. Should we do the same?
482482
#[test_log::test]
483-
#[ignore]
483+
#[ignore = "Needs to be looked into more"]
484484
fn test_strip_tags() {
485485
// NOTE: In the TagLib test suite, this also tests ID3v1 and ID3v2. That is not replicated here.
486486

0 commit comments

Comments
 (0)