Linter fixes
This commit is contained in:
@@ -156,7 +156,7 @@ fn get_metadata(playable: Option<Playable>, spotify: Spotify, library: Arc<Libra
|
|||||||
true => 1.0,
|
true => 1.0,
|
||||||
false => 0.0,
|
false => 0.0,
|
||||||
})
|
})
|
||||||
.unwrap_or(0.0) as f64,
|
.unwrap_or(0.0),
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -118,9 +118,7 @@ impl WebApi {
|
|||||||
.header("Retry-After")
|
.header("Retry-After")
|
||||||
.and_then(|v| v.parse::<u64>().ok());
|
.and_then(|v| v.parse::<u64>().ok());
|
||||||
debug!("rate limit hit. waiting {:?} seconds", waiting_duration);
|
debug!("rate limit hit. waiting {:?} seconds", waiting_duration);
|
||||||
thread::sleep(
|
thread::sleep(Duration::from_secs(waiting_duration.unwrap_or(0)));
|
||||||
Duration::from_secs(waiting_duration.unwrap_or(0) as u64),
|
|
||||||
);
|
|
||||||
cb(&self.api).ok()
|
cb(&self.api).ok()
|
||||||
}
|
}
|
||||||
401 => {
|
401 => {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ impl<I: ListItem + Clone> ApiResult<I> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn at_end(&self) -> bool {
|
pub fn at_end(&self) -> bool {
|
||||||
(self.offset() + self.limit as u32) >= self.total
|
(self.offset() + self.limit) >= self.total
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn apply_pagination(self, pagination: &Pagination<I>) {
|
pub fn apply_pagination(self, pagination: &Pagination<I>) {
|
||||||
@@ -66,7 +66,7 @@ impl<I: ListItem + Clone> ApiResult<I> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn next(&self) -> Option<Vec<I>> {
|
pub fn next(&self) -> Option<Vec<I>> {
|
||||||
let offset = self.offset() + self.limit as u32;
|
let offset = self.offset() + self.limit;
|
||||||
debug!("fetching next page at offset {}", offset);
|
debug!("fetching next page at offset {}", offset);
|
||||||
if !self.at_end() {
|
if !self.at_end() {
|
||||||
if let Some(next_page) = (self.fetch_page)(offset) {
|
if let Some(next_page) = (self.fetch_page)(offset) {
|
||||||
|
|||||||
@@ -151,13 +151,13 @@ impl ViewExt for QueueView {
|
|||||||
ShiftMode::Up if selected > 0 => {
|
ShiftMode::Up if selected > 0 => {
|
||||||
self.queue
|
self.queue
|
||||||
.shift(selected, (selected as i32).saturating_sub(amount) as usize);
|
.shift(selected, (selected as i32).saturating_sub(amount) as usize);
|
||||||
self.list.move_focus(-(amount as i32));
|
self.list.move_focus(-amount);
|
||||||
return Ok(CommandResult::Consumed(None));
|
return Ok(CommandResult::Consumed(None));
|
||||||
}
|
}
|
||||||
ShiftMode::Down if selected < len.saturating_sub(1) => {
|
ShiftMode::Down if selected < len.saturating_sub(1) => {
|
||||||
self.queue
|
self.queue
|
||||||
.shift(selected, min(selected + amount as usize, len - 1));
|
.shift(selected, min(selected + amount as usize, len - 1));
|
||||||
self.list.move_focus(amount as i32);
|
self.list.move_focus(amount);
|
||||||
return Ok(CommandResult::Consumed(None));
|
return Ok(CommandResult::Consumed(None));
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ pub fn cache_path_for_url(url: String) -> std::path::PathBuf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn download(url: String, path: std::path::PathBuf) -> Result<(), std::io::Error> {
|
pub fn download(url: String, path: std::path::PathBuf) -> Result<(), std::io::Error> {
|
||||||
let mut resp = reqwest::blocking::get(&url)
|
let mut resp = reqwest::blocking::get(url)
|
||||||
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?;
|
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?;
|
||||||
|
|
||||||
std::fs::create_dir_all(path.parent().unwrap())?;
|
std::fs::create_dir_all(path.parent().unwrap())?;
|
||||||
|
|||||||
Reference in New Issue
Block a user