Remove some and deny new indexing and slicing

This commit is contained in:
Alexander Krotov
2020-06-22 02:07:10 +03:00
committed by link2xt
parent ee7b7eb4f2
commit 18e4abc1df
18 changed files with 107 additions and 95 deletions

View File

@@ -586,6 +586,7 @@ pub async fn housekeeping(context: &Context) {
info!(context, "Housekeeping done.",);
}
#[allow(clippy::indexing_slicing)]
fn is_file_in_use(files_in_use: &HashSet<String>, namespc_opt: Option<&str>, name: &str) -> bool {
let name_to_check = if let Some(namespc) = namespc_opt {
let name_len = name.len();
@@ -600,6 +601,7 @@ fn is_file_in_use(files_in_use: &HashSet<String>, namespc_opt: Option<&str>, nam
files_in_use.contains(name_to_check)
}
#[allow(clippy::indexing_slicing)] // TODO: use str.strip_prefix once it is released in stable
fn maybe_add_file(files_in_use: &mut HashSet<String>, file: impl AsRef<str>) {
if !file.as_ref().starts_with("$BLOBDIR/") {
return;