fmt, clippy
This commit is contained in:
+10
-3
@@ -61,8 +61,11 @@ pub fn parse_filename(name: &str) -> Option<FilesEntry> {
|
||||
if let Some(dot) = rest.rfind('.') {
|
||||
let arch = &rest[..dot];
|
||||
let ptype = &rest[dot + 1..];
|
||||
let valid = |s: &str| !s.is_empty()
|
||||
&& s.chars().all(|c| c.is_ascii_alphanumeric() || "-+.:~".contains(c));
|
||||
let valid = |s: &str| {
|
||||
!s.is_empty()
|
||||
&& s.chars()
|
||||
.all(|c| c.is_ascii_alphanumeric() || "-+.:~".contains(c))
|
||||
};
|
||||
if valid(pkg) && valid(version) && valid(arch) && valid(ptype) {
|
||||
return Some(FilesEntry {
|
||||
filename: name.to_string(),
|
||||
@@ -128,7 +131,11 @@ impl FilesList {
|
||||
return Err(format!("badly formed line in '{}': {}", path.display(), line).into());
|
||||
}
|
||||
let mut entry = parse_filename(tokens[0]).ok_or_else(|| {
|
||||
format!("badly formed file name in '{}': {}", path.display(), tokens[0])
|
||||
format!(
|
||||
"badly formed file name in '{}': {}",
|
||||
path.display(),
|
||||
tokens[0]
|
||||
)
|
||||
})?;
|
||||
entry.section = tokens[1].to_string();
|
||||
entry.priority = tokens[2].to_string();
|
||||
|
||||
Reference in New Issue
Block a user