cargo clippy
This commit is contained in:
@@ -283,7 +283,7 @@ fn run_dbus_server(
|
|||||||
.on_set(move |i, _| {
|
.on_set(move |i, _| {
|
||||||
let cur = spotify2.volume() as f64 / 65535_f64;
|
let cur = spotify2.volume() as f64 / 65535_f64;
|
||||||
let req = i.get::<f64>().unwrap_or(cur);
|
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;
|
let vol = (VOLUME_PERCENT as f64) * req * 100.0;
|
||||||
spotify2.set_volume(vol as u16);
|
spotify2.set_volume(vol as u16);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,10 +105,9 @@ impl Queue {
|
|||||||
if let Some(order) = random_order.as_mut() {
|
if let Some(order) = random_order.as_mut() {
|
||||||
let next_i = order.iter().position(|&i| i == index).unwrap();
|
let next_i = order.iter().position(|&i| i == index).unwrap();
|
||||||
// shift everything after the insertion in order
|
// shift everything after the insertion in order
|
||||||
let size = order.len();
|
for item in order.iter_mut() {
|
||||||
for i in 0..size {
|
if *item > index {
|
||||||
if order[i] > index {
|
*item += 1;
|
||||||
order[i] += 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// finally, add the next track index
|
// finally, add the next track index
|
||||||
|
|||||||
@@ -260,9 +260,9 @@ impl Spotify {
|
|||||||
let volume = match &cfg.values().saved_state {
|
let volume = match &cfg.values().saved_state {
|
||||||
Some(state) => match state.volume {
|
Some(state) => match state.volume {
|
||||||
Some(vol) => ((std::cmp::min(vol, 100) as f32) / 100.0 * 65535_f32).ceil() as u16,
|
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 {
|
let repeat = match &cfg.values().saved_state {
|
||||||
Some(state) => match &state.repeat {
|
Some(state) => match &state.repeat {
|
||||||
|
|||||||
Reference in New Issue
Block a user