Fix lints for Rust 1.86
This commit is contained in:
parent
1b22d7d5fc
commit
53ce0e3a88
6 changed files with 21 additions and 19 deletions
|
|
@ -117,9 +117,7 @@ impl Download {
|
||||||
|
|
||||||
pub fn start(&mut self) -> Task<Update> {
|
pub fn start(&mut self) -> Task<Update> {
|
||||||
match self.state {
|
match self.state {
|
||||||
State::Idle { .. }
|
State::Idle | State::Finished | State::Errored => {
|
||||||
| State::Finished { .. }
|
|
||||||
| State::Errored { .. } => {
|
|
||||||
let (task, handle) = Task::sip(
|
let (task, handle) = Task::sip(
|
||||||
download(
|
download(
|
||||||
"https://huggingface.co/\
|
"https://huggingface.co/\
|
||||||
|
|
@ -161,10 +159,10 @@ impl Download {
|
||||||
|
|
||||||
pub fn view(&self) -> Element<Message> {
|
pub fn view(&self) -> Element<Message> {
|
||||||
let current_progress = match &self.state {
|
let current_progress = match &self.state {
|
||||||
State::Idle { .. } => 0.0,
|
State::Idle => 0.0,
|
||||||
State::Downloading { progress, .. } => *progress,
|
State::Downloading { progress, .. } => *progress,
|
||||||
State::Finished { .. } => 100.0,
|
State::Finished => 100.0,
|
||||||
State::Errored { .. } => 0.0,
|
State::Errored => 0.0,
|
||||||
};
|
};
|
||||||
|
|
||||||
let progress_bar = progress_bar(0.0..=100.0, current_progress);
|
let progress_bar = progress_bar(0.0..=100.0, current_progress);
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ impl Pokedex {
|
||||||
let subtitle = match self {
|
let subtitle = match self {
|
||||||
Pokedex::Loading => "Loading",
|
Pokedex::Loading => "Loading",
|
||||||
Pokedex::Loaded { pokemon, .. } => &pokemon.name,
|
Pokedex::Loaded { pokemon, .. } => &pokemon.name,
|
||||||
Pokedex::Errored { .. } => "Whoops!",
|
Pokedex::Errored => "Whoops!",
|
||||||
};
|
};
|
||||||
|
|
||||||
format!("{subtitle} - Pokédex")
|
format!("{subtitle} - Pokédex")
|
||||||
|
|
|
||||||
|
|
@ -327,9 +327,10 @@ mod toast {
|
||||||
instants.truncate(new);
|
instants.truncate(new);
|
||||||
}
|
}
|
||||||
(old, new) if old < new => {
|
(old, new) if old < new => {
|
||||||
instants.extend(
|
instants.extend(std::iter::repeat_n(
|
||||||
std::iter::repeat(Some(Instant::now())).take(new - old),
|
Some(Instant::now()),
|
||||||
);
|
new - old,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,8 @@ use std::ops::RangeBounds;
|
||||||
|
|
||||||
pub const MAX_WRITE_SIZE: usize = 100 * 1024;
|
pub const MAX_WRITE_SIZE: usize = 100 * 1024;
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
const MAX_WRITE_SIZE_U64: NonZeroU64 = NonZeroU64::new(MAX_WRITE_SIZE as u64)
|
||||||
const MAX_WRITE_SIZE_U64: NonZeroU64 =
|
.expect("MAX_WRITE_SIZE must be non-zero");
|
||||||
unsafe { NonZeroU64::new_unchecked(MAX_WRITE_SIZE as u64) };
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Buffer<T> {
|
pub struct Buffer<T> {
|
||||||
|
|
|
||||||
|
|
@ -120,8 +120,10 @@ impl Value {
|
||||||
/// dot ('•') character.
|
/// dot ('•') character.
|
||||||
pub fn secure(&self) -> Self {
|
pub fn secure(&self) -> Self {
|
||||||
Self {
|
Self {
|
||||||
graphemes: std::iter::repeat(String::from("•"))
|
graphemes: std::iter::repeat_n(
|
||||||
.take(self.graphemes.len())
|
String::from("•"),
|
||||||
|
self.graphemes.len(),
|
||||||
|
)
|
||||||
.collect(),
|
.collect(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -386,9 +386,11 @@ where
|
||||||
renderer,
|
renderer,
|
||||||
&layout::Limits::new(
|
&layout::Limits::new(
|
||||||
Size::ZERO,
|
Size::ZERO,
|
||||||
self.snap_within_viewport
|
if self.snap_within_viewport {
|
||||||
.then(|| viewport.size())
|
viewport.size()
|
||||||
.unwrap_or(Size::INFINITY),
|
} else {
|
||||||
|
Size::INFINITY
|
||||||
|
},
|
||||||
)
|
)
|
||||||
.shrink(Padding::new(self.padding)),
|
.shrink(Padding::new(self.padding)),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue