clippy: Fix various clippy warnings throughout the code (#33003)

* replace u64::max_value() with u64::MAX

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* removed redundant import

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* Fixed dereference

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* Fixed a probable bug

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* fixed imports

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* fixed dereference

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* dereference formatting

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* removed unnessicary number imports

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* removed unnessicary number imports

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* removed excess borrow

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* ran mach fmt

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* fixed doc comment

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* removed deref on an immutable reference

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* fixed minor syntax error

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* reverted clamping

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* formatting

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

* reverted final clamp

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
Co-authored-by: Ashwin Naren <ashwin@pixelators.org>
This commit is contained in:
Ashwin Naren 2024-08-12 22:16:47 -07:00 committed by GitHub
parent 0d137d276a
commit ea5cf75169
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 25 additions and 29 deletions

View file

@ -416,7 +416,7 @@ fn handle_range_request(
// whose body is in the ResponseBody::Receiving state.
(&(Bound::Included(beginning), Bound::Included(end)), Some(complete_resource)) => {
if let ResponseBody::Done(ref body) = *complete_resource.body.lock().unwrap() {
if end == u64::max_value() {
if end == u64::MAX {
// Prevent overflow on the addition below.
return None;
}
@ -552,11 +552,7 @@ fn handle_range_request(
} else {
continue;
};
if total < res_beginning ||
total < res_end ||
offset == 0 ||
offset == u64::max_value()
{
if total < res_beginning || total < res_end || offset == 0 || offset == u64::MAX {
// Prevent overflow in the below operations from occuring.
continue;
}