fix: resolve clippy issues
This commit is contained in:
1 parent
eb91c908fc
commit
971375bf1f
18 files changed
+80
-116
No files matched your search
@@ -18,11 +18,7 @@ pub(crate) fn parse_enabled_stem(file_name: &str, ext: &str) -> Option<(bool, St
|
||||
let disabled_ext = format!("{ext}.disabled");
|
||||
if let Some(stem) = file_name.strip_suffix(&disabled_ext) {
|
||||
Some((false, stem.to_string()))
|
||||
} else if let Some(stem) = file_name.strip_suffix(ext) {
|
||||
Some((true, stem.to_string()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else { file_name.strip_suffix(ext).map(|stem| (true, stem.to_string())) }
|
||||
}
|
||||
|
||||
/// For directories: check if the name ends in `.disabled`.
|
||||
|
||||
@@ -71,17 +71,15 @@ fn world_description(world_dir: &Path) -> String {
|
||||
|
||||
let mut lines = Vec::new();
|
||||
|
||||
if let Some(secs) = created {
|
||||
if let Some(dt) = chrono::DateTime::from_timestamp(secs as i64, 0) {
|
||||
if let Some(secs) = created
|
||||
&& let Some(dt) = chrono::DateTime::from_timestamp(secs as i64, 0) {
|
||||
lines.push(format!("Created: {}", dt.format("%Y-%m-%d %H:%M")));
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(secs) = modified {
|
||||
if let Some(dt) = chrono::DateTime::from_timestamp(secs as i64, 0) {
|
||||
if let Some(secs) = modified
|
||||
&& let Some(dt) = chrono::DateTime::from_timestamp(secs as i64, 0) {
|
||||
lines.push(format!("Played: {}", dt.format("%Y-%m-%d %H:%M")));
|
||||
}
|
||||
}
|
||||
|
||||
if dir_size > 0 {
|
||||
lines.push(format!("Size: {}", format_size(dir_size)));
|
||||
@@ -94,11 +92,10 @@ fn dir_size_approx(path: &Path) -> u64 {
|
||||
let mut total = 0u64;
|
||||
if let Ok(rd) = std::fs::read_dir(path) {
|
||||
for entry in rd.flatten() {
|
||||
if let Ok(meta) = entry.metadata() {
|
||||
if meta.is_file() {
|
||||
if let Ok(meta) = entry.metadata()
|
||||
&& meta.is_file() {
|
||||
total += meta.len();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Check region folder too (main chunk data)
|
||||
|
||||
Reference in new issue
Block a user