Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary casts throughout stackslib #5624

Merged
merged 3 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
CRC: remove unnecessary brackets and store total_requests_sent as a l…
…ocal var

Signed-off-by: Jacinta Ferrant <[email protected]>
  • Loading branch information
jferrant committed Jan 2, 2025
commit 9615a715013acbfe1f703ffa99286e79e36fc0a0
8 changes: 4 additions & 4 deletions stackslib/src/net/atlas/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1314,11 +1314,11 @@ impl ReliabilityReport {
}

pub fn score(&self) -> u32 {
if self.total_requests_sent == 0 {
return 0;
let n = self.total_requests_sent;
if n == 0 {
return n;
}
self.total_requests_success * 1000 / (self.total_requests_sent * 1000)
+ self.total_requests_sent
self.total_requests_success * 1000 / (n * 1000) + n
}
}

Expand Down
2 changes: 1 addition & 1 deletion stackslib/src/util_lib/strings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ impl StacksString {
// This is 0x20 through 0x7e, inclusive, as well as '\t' and '\n'
// TODO: DRY up with vm::representations
for c in s.as_bytes().iter() {
if (*c < 0x20 && *c != (b'\t') && *c != (b'\n')) || (*c > 0x7e) {
if (*c < 0x20 && *c != b'\t' && *c != b'\n') || *c > 0x7e {
return false;
}
}
Expand Down