clippy: Fix warnings in components/net (#31626)

* clippy: fix warnings in `components/net`

* fix: review comments
This commit is contained in:
eri 2024-03-13 10:40:04 +01:00 committed by GitHub
parent 5ea0531775
commit 63527f56ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 54 additions and 53 deletions

View file

@ -125,6 +125,7 @@ impl FileManager {
// Read a file for the Fetch implementation.
// It gets the required headers synchronously and reads the actual content
// in a separate thread.
#[allow(clippy::too_many_arguments)]
pub fn fetch_file(
&self,
done_sender: &mut TokioSender<Data>,
@ -278,6 +279,7 @@ impl FileManager {
});
}
#[allow(clippy::too_many_arguments)]
fn fetch_blob_buf(
&self,
done_sender: &mut TokioSender<Data>,
@ -824,22 +826,20 @@ impl FileManagerStore {
}
fn promote_memory(&self, id: Uuid, blob_buf: BlobBuf, set_valid: bool, origin: FileOrigin) {
match Url::parse(&origin) {
// parse to check sanity
Ok(_) => {
self.insert(
id,
FileStoreEntry {
origin,
file_impl: FileImpl::Memory(blob_buf),
refs: AtomicUsize::new(1),
is_valid_url: AtomicBool::new(set_valid),
outstanding_tokens: Default::default(),
},
);
},
Err(_) => {},
// parse to check sanity
if Url::parse(&origin).is_err() {
return;
}
self.insert(
id,
FileStoreEntry {
origin,
file_impl: FileImpl::Memory(blob_buf),
refs: AtomicUsize::new(1),
is_valid_url: AtomicBool::new(set_valid),
outstanding_tokens: Default::default(),
},
);
}
fn set_blob_url_validity(