refactor: Apply clippy suggestions
This commit is contained in:
parent
905734019e
commit
78eb25368c
7 changed files with 13 additions and 15 deletions
|
@ -14,7 +14,7 @@ use crate::cmd::util::collect_bundle_paths;
|
||||||
fn parse_glob_pattern(s: &str) -> Result<Pattern, String> {
|
fn parse_glob_pattern(s: &str) -> Result<Pattern, String> {
|
||||||
match Pattern::new(s) {
|
match Pattern::new(s) {
|
||||||
Ok(p) => Ok(p),
|
Ok(p) => Ok(p),
|
||||||
Err(e) => Err(format!("Invalid glob pattern '{}': {}", s, e)),
|
Err(e) => Err(format!("Invalid glob pattern '{s}': {e}")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ pub(crate) async fn run(ctx: Arc<RwLock<sdk::Context>>, matches: &ArgMatches) ->
|
||||||
name.clone()
|
name.clone()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.unwrap_or(format!("{}", i));
|
.unwrap_or(format!("{i}"));
|
||||||
|
|
||||||
path.push(name);
|
path.push(name);
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ pub(crate) async fn run(ctx: Arc<RwLock<sdk::Context>>, matches: &ArgMatches) ->
|
||||||
let ctx = ctx.read().await;
|
let ctx = ctx.read().await;
|
||||||
for group in groups {
|
for group in groups {
|
||||||
let value = ctx.lookup_hash(*hash, (*group).into());
|
let value = ctx.lookup_hash(*hash, (*group).into());
|
||||||
println!("{}", value);
|
println!("{value}");
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -125,7 +125,7 @@ mod tests {
|
||||||
|
|
||||||
for p in paths.iter() {
|
for p in paths.iter() {
|
||||||
let name = p.file_name().and_then(std::ffi::OsStr::to_str).unwrap();
|
let name = p.file_name().and_then(std::ffi::OsStr::to_str).unwrap();
|
||||||
assert!(bundle_names.iter().find(|&n| n == &name).is_some());
|
assert!(bundle_names.iter().any(|n| n == &name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ where
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Err(err).with_section(|| format!("{pos:#X} ({pos})", pos = pos).header("Position: "))
|
Err(err).with_section(|| format!("{pos:#X} ({pos})").header("Position: "))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) async fn write_padding<W>(w: &mut W) -> Result<usize>
|
pub(crate) async fn write_padding<W>(w: &mut W) -> Result<usize>
|
||||||
|
|
|
@ -146,7 +146,7 @@ impl BundleFileType {
|
||||||
BundleFileType::WwiseStream => String::from("wwise_stream"),
|
BundleFileType::WwiseStream => String::from("wwise_stream"),
|
||||||
BundleFileType::Xml => String::from("xml"),
|
BundleFileType::Xml => String::from("xml"),
|
||||||
|
|
||||||
BundleFileType::Unknown(s) => format!("{:016X}", s),
|
BundleFileType::Unknown(s) => format!("{s:016X}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ impl Context {
|
||||||
s.to_owned()
|
s.to_owned()
|
||||||
} else {
|
} else {
|
||||||
tracing::debug!(%hash, "Murmur64 lookup failed");
|
tracing::debug!(%hash, "Murmur64 lookup failed");
|
||||||
format!("{:016X}", hash)
|
format!("{hash:016X}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ impl Context {
|
||||||
s.to_owned()
|
s.to_owned()
|
||||||
} else {
|
} else {
|
||||||
tracing::debug!(%hash, "Murmur32 lookup failed");
|
tracing::debug!(%hash, "Murmur32 lookup failed");
|
||||||
format!("{:08X}", hash)
|
format!("{hash:08X}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,6 @@ where
|
||||||
s.to_owned()
|
s.to_owned()
|
||||||
} else {
|
} else {
|
||||||
tracing::debug!(%hash, "Murmur64 lookup failed");
|
tracing::debug!(%hash, "Murmur64 lookup failed");
|
||||||
format!("{:016X}", hash)
|
format!("{hash:016X}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,8 +99,7 @@ impl<'de> Visitor<'de> for Murmur64 {
|
||||||
match Murmur64::try_from(value) {
|
match Murmur64::try_from(value) {
|
||||||
Ok(hash) => Ok(hash),
|
Ok(hash) => Ok(hash),
|
||||||
Err(err) => Err(E::custom(format!(
|
Err(err) => Err(E::custom(format!(
|
||||||
"failed to convert '{}' to Murmur64: {}",
|
"failed to convert '{value}' to Murmur64: {err}"
|
||||||
value, err
|
|
||||||
))),
|
))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,7 +119,7 @@ impl Serialize for Murmur64 {
|
||||||
where
|
where
|
||||||
S: Serializer,
|
S: Serializer,
|
||||||
{
|
{
|
||||||
serializer.serialize_str(&format!("{:016X}", self))
|
serializer.serialize_str(&format!("{self:016X}"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +154,7 @@ impl Serialize for Murmur32 {
|
||||||
where
|
where
|
||||||
S: Serializer,
|
S: Serializer,
|
||||||
{
|
{
|
||||||
serializer.serialize_str(&format!("{:08X}", self))
|
serializer.serialize_str(&format!("{self:08X}"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,8 +197,7 @@ impl<'de> Visitor<'de> for Murmur32 {
|
||||||
match Murmur32::try_from(value) {
|
match Murmur32::try_from(value) {
|
||||||
Ok(hash) => Ok(hash),
|
Ok(hash) => Ok(hash),
|
||||||
Err(err) => Err(E::custom(format!(
|
Err(err) => Err(E::custom(format!(
|
||||||
"failed to convert '{}' to Murmur32: {}",
|
"failed to convert '{value}' to Murmur32: {err}"
|
||||||
value, err
|
|
||||||
))),
|
))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue