clippy: use chars / byte string literals
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
3984a5fd77
commit
d8d8af9826
@ -1344,7 +1344,7 @@ fn catalog(
|
||||
if !components.is_empty() && components[0] == b'/' {
|
||||
components.remove(0);
|
||||
}
|
||||
for component in components.split(|c| *c == '/' as u8) {
|
||||
for component in components.split(|c| *c == b'/') {
|
||||
if let Some(entry) = catalog_reader.lookup(¤t, component)? {
|
||||
current = entry;
|
||||
} else {
|
||||
@ -1357,7 +1357,7 @@ fn catalog(
|
||||
|
||||
for direntry in catalog_reader.read_dir(¤t)? {
|
||||
let mut components = components.clone();
|
||||
components.push('/' as u8);
|
||||
components.push(b'/');
|
||||
components.extend(&direntry.name);
|
||||
let path = base64::encode(components);
|
||||
let text = String::from_utf8_lossy(&direntry.name);
|
||||
@ -1491,7 +1491,7 @@ fn pxar_file_download(
|
||||
components.remove(0);
|
||||
}
|
||||
|
||||
let mut split = components.splitn(2, |c| *c == '/' as u8);
|
||||
let mut split = components.splitn(2, |c| *c == b'/');
|
||||
let pxar_name = std::str::from_utf8(split.next().unwrap())?;
|
||||
let file_path = split.next().ok_or(format_err!("filepath looks strange '{}'", filepath))?;
|
||||
let (manifest, files) = read_backup_index(&datastore, &backup_dir)?;
|
||||
|
@ -44,7 +44,7 @@ fn digest_to_prefix(digest: &[u8]) -> PathBuf {
|
||||
buf.push(HEX_CHARS[(digest[0] as usize) &0xf]);
|
||||
buf.push(HEX_CHARS[(digest[1] as usize) >> 4]);
|
||||
buf.push(HEX_CHARS[(digest[1] as usize) & 0xf]);
|
||||
buf.push('/' as u8);
|
||||
buf.push(b'/');
|
||||
|
||||
let path = unsafe { String::from_utf8_unchecked(buf)};
|
||||
|
||||
@ -226,7 +226,7 @@ impl ChunkStore {
|
||||
continue;
|
||||
}
|
||||
|
||||
let bad = bytes.ends_with(".bad".as_bytes());
|
||||
let bad = bytes.ends_with(b".bad");
|
||||
return Some((Ok(entry), percentage, bad));
|
||||
}
|
||||
Some(Err(err)) => {
|
||||
|
@ -390,7 +390,7 @@ impl DataStore {
|
||||
fn is_hidden(entry: &walkdir::DirEntry) -> bool {
|
||||
entry.file_name()
|
||||
.to_str()
|
||||
.map(|s| s.starts_with("."))
|
||||
.map(|s| s.starts_with('.'))
|
||||
.unwrap_or(false)
|
||||
}
|
||||
let handle_entry_err = |err: walkdir::Error| {
|
||||
|
@ -578,7 +578,7 @@ pub fn complete_port_list(arg: &str, _param: &HashMap<String, String>) -> Vec<St
|
||||
};
|
||||
|
||||
let arg = arg.trim();
|
||||
let prefix = if let Some(idx) = arg.rfind(",") { &arg[..idx+1] } else { "" };
|
||||
let prefix = if let Some(idx) = arg.rfind(',') { &arg[..idx+1] } else { "" };
|
||||
ports.iter().map(|port| format!("{}{}", prefix, port)).collect()
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ fn parse_register_response(
|
||||
info.message = Some("Invalid Server ID".into()),
|
||||
"message" => info.message = Some(value.into()),
|
||||
"validdirectory" => {
|
||||
if value.split(",").find(is_server_id) == None {
|
||||
if value.split(',').find(is_server_id) == None {
|
||||
bail!("Server ID does not match");
|
||||
}
|
||||
info.serverid = Some(server_id.to_owned());
|
||||
|
Loading…
Reference in New Issue
Block a user