Satisfy rustfmt and clippy on the album and folder picker changes
rustfmt over the files the albums work touched, and the album merge's incoming row as a named struct rather than an eight-field tuple, which clippy's type_complexity refused.
This commit is contained in:
@@ -18,7 +18,11 @@ use dr_sync::{Connection, EntryKind, RemotePath};
|
||||
|
||||
/// Child folder names at `path` (empty is the account root), sorted as a
|
||||
/// person reads them.
|
||||
pub fn list(conn: Connection, path: String, done: impl FnOnce(Result<Vec<String>, String>) + 'static) {
|
||||
pub fn list(
|
||||
conn: Connection,
|
||||
path: String,
|
||||
done: impl FnOnce(Result<Vec<String>, String>) + 'static,
|
||||
) {
|
||||
run(conn, done, move |backend| {
|
||||
Box::pin(async move { children(backend.as_ref(), &path).await })
|
||||
});
|
||||
@@ -129,28 +133,34 @@ where
|
||||
let mut done = Some(done);
|
||||
let timer = slint::Timer::default();
|
||||
let held = slot.clone();
|
||||
timer.start(slint::TimerMode::Repeated, Duration::from_millis(100), move || {
|
||||
let outcome = match rx.try_recv() {
|
||||
Ok(result) => result,
|
||||
Err(TryRecvError::Empty) => return,
|
||||
// A worker that panicked drops the sender without sending, and
|
||||
// treating that as "still loading" is how a picker sits on
|
||||
// "Loading…" for ever.
|
||||
Err(TryRecvError::Disconnected) => Err("the folder request failed unexpectedly".into()),
|
||||
};
|
||||
if let Some(done) = done.take() {
|
||||
done(outcome);
|
||||
}
|
||||
// Stopped here, released a turn later: a timer dropped inside its
|
||||
// own callback is freed while Slint is still calling it.
|
||||
if let Some(t) = held.borrow().as_ref() {
|
||||
t.stop();
|
||||
}
|
||||
let held = held.clone();
|
||||
slint::Timer::single_shot(Duration::ZERO, move || {
|
||||
held.borrow_mut().take();
|
||||
});
|
||||
});
|
||||
timer.start(
|
||||
slint::TimerMode::Repeated,
|
||||
Duration::from_millis(100),
|
||||
move || {
|
||||
let outcome = match rx.try_recv() {
|
||||
Ok(result) => result,
|
||||
Err(TryRecvError::Empty) => return,
|
||||
// A worker that panicked drops the sender without sending, and
|
||||
// treating that as "still loading" is how a picker sits on
|
||||
// "Loading…" for ever.
|
||||
Err(TryRecvError::Disconnected) => {
|
||||
Err("the folder request failed unexpectedly".into())
|
||||
}
|
||||
};
|
||||
if let Some(done) = done.take() {
|
||||
done(outcome);
|
||||
}
|
||||
// Stopped here, released a turn later: a timer dropped inside its
|
||||
// own callback is freed while Slint is still calling it.
|
||||
if let Some(t) = held.borrow().as_ref() {
|
||||
t.stop();
|
||||
}
|
||||
let held = held.clone();
|
||||
slint::Timer::single_shot(Duration::ZERO, move || {
|
||||
held.borrow_mut().take();
|
||||
});
|
||||
},
|
||||
);
|
||||
*slot.borrow_mut() = Some(timer);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user