fix: tests, clippy lints

This commit is contained in:
ThetaDev 2023-10-08 01:04:52 +02:00
parent e247b0c5d9
commit 1ec1666d77
4 changed files with 24 additions and 24 deletions

View file

@ -228,16 +228,15 @@ pub enum Country {
.to_owned();
for (code, native_name) in &languages {
let enum_name = code
.split('-')
.map(|c| {
format!(
"{}{}",
c[0..1].to_owned().to_uppercase(),
c[1..].to_owned().to_lowercase()
)
})
.collect::<String>();
let enum_name = code.split('-').fold(String::new(), |mut output, c| {
let _ = write!(
output,
"{}{}",
c[0..1].to_owned().to_uppercase(),
c[1..].to_owned().to_lowercase()
);
output
});
let en_name = lang_names.get(code).expect(code);

View file

@ -134,12 +134,16 @@ where
if c.is_ascii_digit() {
buf.push(c);
} else if !buf.is_empty() {
buf.parse::<F>().map_or((), |n| numbers.push(n));
if let Ok(n) = buf.parse::<F>() {
numbers.push(n);
}
buf.clear();
}
}
if !buf.is_empty() {
buf.parse::<F>().map_or((), |n| numbers.push(n));
if let Ok(n) = buf.parse::<F>() {
numbers.push(n);
}
}
numbers

View file

@ -159,12 +159,16 @@ where
if c.is_ascii_digit() {
buf.push(c);
} else if !buf.is_empty() {
buf.parse::<F>().map_or((), |n| numbers.push(n));
if let Ok(n) = buf.parse::<F>() {
numbers.push(n);
}
buf.clear();
}
}
if !buf.is_empty() {
buf.parse::<F>().map_or((), |n| numbers.push(n));
if let Ok(n) = buf.parse::<F>() {
numbers.push(n);
}
}
numbers

View file

@ -326,13 +326,6 @@ fn get_player_error(#[case] id: &str, #[case] expect: UnavailabilityReason, rp:
None,
Some(("UCIekuFeMaV78xYfvpmoCnPg", "Best Music")),
)]
#[case::short(
"RDCLAK5uy_kFQXdnqMaQCVx2wpUM4ZfbsGCDibZtkJk",
"Easy Pop",
false,
None,
None
)]
#[case::nomusic(
"PL1J-6JOckZtE_P9Xx8D3b2O6w0idhuKBe",
"Minecraft SHINE",
@ -1127,10 +1120,10 @@ mod channel_rss {
#[rstest]
fn get_channel_rss_empty(rp: RustyPipe) {
let channel =
tokio_test::block_on(rp.query().channel_rss("UC4fJNIVEOQ1fk15B_sqoOqg")).unwrap();
tokio_test::block_on(rp.query().channel_rss("UCAyFbMjB3qAQSZBj6NCuBSg")).unwrap();
assert_eq!(channel.id, "UC4fJNIVEOQ1fk15B_sqoOqg");
assert_eq!(channel.name, "Bilal Saeed - Topic");
assert_eq!(channel.id, "UCAyFbMjB3qAQSZBj6NCuBSg");
assert_eq!(channel.name, "Cheryl Calogero");
assert!(channel.videos.is_empty());
}