partial clippy, plus

This commit is contained in:
Mike Dilger 2023-08-19 08:42:10 +12:00
parent 3b27289f53
commit 941f14d8cb
2 changed files with 10 additions and 10 deletions

View File

@ -41,14 +41,17 @@ impl Relay {
}
}
#[inline]
pub fn set_usage_bits(&mut self, bits: u64) {
self.usage_bits |= bits;
}
#[inline]
pub fn clear_usage_bits(&mut self, bits: u64) {
self.usage_bits &= !bits;
}
#[inline]
pub fn adjust_usage_bit(&mut self, bit: u64, value: bool) {
if value {
self.set_usage_bits(bit);
@ -57,16 +60,19 @@ impl Relay {
}
}
#[inline]
pub fn has_usage_bits(&self, bits: u64) -> bool {
self.usage_bits & bits == bits
}
#[inline]
pub fn attempts(&self) -> u64 {
self.success_count + self.failure_count
}
#[inline]
pub fn success_rate(&self) -> f32 {
let attempts = self.success_count + self.failure_count;
let attempts = self.attempts();
if attempts == 0 {
return 0.5;
} // unknown, so we put it in the middle

View File

@ -548,15 +548,9 @@ impl RelayEntry {
const RIGHT: f32 = -17.0;
const SPACE: f32 = 23.0;
let right = match self.view {
// RelayEntryView::Detail => {
// pos2(rect.max.x, rect.min.y) + vec2(-TEXT_RIGHT, TEXT_TOP + 30.0)
// }
_ => {
pos2(rect.max.x, rect.min.y)
+ vec2(-TEXT_RIGHT - EDIT_BTN_SIZE - SPACE, TEXT_TOP + 4.0)
}
};
// match self.view { RelayEntryView::Detail => ... }
let right = pos2(rect.max.x, rect.min.y)
+ vec2(-TEXT_RIGHT - EDIT_BTN_SIZE - SPACE, TEXT_TOP + 4.0);
let align = Align::Center;