cargo clippy

This commit is contained in:
Henrik Friedrichsen
2021-01-02 21:30:52 +01:00
parent 9069be8565
commit 3874dc42f8
3 changed files with 6 additions and 7 deletions

View File

@@ -283,7 +283,7 @@ fn run_dbus_server(
.on_set(move |i, _| {
let cur = spotify2.volume() as f64 / 65535_f64;
let req = i.get::<f64>().unwrap_or(cur);
if req >= 0.0 && req <= 1.0 {
if (0.0..=1.0).contains(&req) {
let vol = (VOLUME_PERCENT as f64) * req * 100.0;
spotify2.set_volume(vol as u16);
}

View File

@@ -105,10 +105,9 @@ impl Queue {
if let Some(order) = random_order.as_mut() {
let next_i = order.iter().position(|&i| i == index).unwrap();
// shift everything after the insertion in order
let size = order.len();
for i in 0..size {
if order[i] > index {
order[i] += 1;
for item in order.iter_mut() {
if *item > index {
*item += 1;
}
}
// finally, add the next track index

View File

@@ -260,9 +260,9 @@ impl Spotify {
let volume = match &cfg.values().saved_state {
Some(state) => match state.volume {
Some(vol) => ((std::cmp::min(vol, 100) as f32) / 100.0 * 65535_f32).ceil() as u16,
None => 0xFFFF as u16,
None => 0xFFFF_u16,
},
None => 0xFFFF as u16,
None => 0xFFFF_u16,
};
let repeat = match &cfg.values().saved_state {
Some(state) => match &state.repeat {