Fix warnings
This commit is contained in:
parent
e9da2bfb90
commit
9b22c8f9ed
4 changed files with 23 additions and 45 deletions
36
src/app.rs
36
src/app.rs
|
|
@ -3,8 +3,7 @@
|
|||
|
||||
use cosmic::{
|
||||
app::{message, Command, Core},
|
||||
cosmic_config::{self, CosmicConfigEntry},
|
||||
cosmic_theme, executor,
|
||||
cosmic_config, cosmic_theme, executor,
|
||||
iced::{
|
||||
event,
|
||||
futures::{self, SinkExt},
|
||||
|
|
@ -237,19 +236,6 @@ impl App {
|
|||
cosmic::app::command::set_theme(self.config.app_theme.theme())
|
||||
}
|
||||
|
||||
fn save_config(&mut self) -> Command<Message> {
|
||||
match self.config_handler {
|
||||
Some(ref config_handler) => match self.config.write_entry(&config_handler) {
|
||||
Ok(()) => {}
|
||||
Err(err) => {
|
||||
log::error!("failed to save config: {}", err);
|
||||
}
|
||||
},
|
||||
None => {}
|
||||
}
|
||||
self.update_config()
|
||||
}
|
||||
|
||||
fn update_title(&mut self) -> Command<Message> {
|
||||
let (header_title, window_title) = match self.tab_model.text(self.tab_model.active()) {
|
||||
Some(tab_title) => (
|
||||
|
|
@ -317,7 +303,7 @@ impl App {
|
|||
|
||||
if !self.pending_operations.is_empty() {
|
||||
let mut section = widget::settings::view_section(fl!("pending"));
|
||||
for (id, (op, progress)) in self.pending_operations.iter().rev() {
|
||||
for (_id, (op, progress)) in self.pending_operations.iter().rev() {
|
||||
section = section.add(widget::column::with_children(vec![
|
||||
widget::text(format!("{:?}", op)).into(),
|
||||
widget::progress_bar(0.0..=100.0, *progress)
|
||||
|
|
@ -330,7 +316,7 @@ impl App {
|
|||
|
||||
if !self.failed_operations.is_empty() {
|
||||
let mut section = widget::settings::view_section(fl!("failed"));
|
||||
for (id, (op, error)) in self.failed_operations.iter().rev() {
|
||||
for (_id, (op, error)) in self.failed_operations.iter().rev() {
|
||||
section = section.add(widget::column::with_children(vec![
|
||||
widget::text(format!("{:?}", op)).into(),
|
||||
widget::text(error).into(),
|
||||
|
|
@ -341,7 +327,7 @@ impl App {
|
|||
|
||||
if !self.complete_operations.is_empty() {
|
||||
let mut section = widget::settings::view_section(fl!("complete"));
|
||||
for (id, op) in self.complete_operations.iter().rev() {
|
||||
for (_id, op) in self.complete_operations.iter().rev() {
|
||||
section = section.add(widget::text(format!("{:?}", op)));
|
||||
}
|
||||
children.push(section.into());
|
||||
|
|
@ -635,10 +621,10 @@ impl Application for App {
|
|||
return self.update_config();
|
||||
}
|
||||
}
|
||||
Message::Copy(entity_opt) => {
|
||||
Message::Copy(_entity_opt) => {
|
||||
log::warn!("TODO: COPY");
|
||||
}
|
||||
Message::Cut(entity_opt) => {
|
||||
Message::Cut(_entity_opt) => {
|
||||
log::warn!("TODO: CUT");
|
||||
}
|
||||
Message::Key(modifiers, key) => {
|
||||
|
|
@ -668,10 +654,10 @@ impl Application for App {
|
|||
self.operation(Operation::Delete { paths });
|
||||
}
|
||||
}
|
||||
Message::NewFile(entity_opt) => {
|
||||
Message::NewFile(_entity_opt) => {
|
||||
log::warn!("TODO: NEW FILE");
|
||||
}
|
||||
Message::NewFolder(entity_opt) => {
|
||||
Message::NewFolder(_entity_opt) => {
|
||||
log::warn!("TODO: NEW FOLDER");
|
||||
}
|
||||
Message::NotifyEvent(event) => {
|
||||
|
|
@ -712,7 +698,7 @@ impl Application for App {
|
|||
log::warn!("message did not contain notify watcher");
|
||||
}
|
||||
},
|
||||
Message::Paste(entity_opt) => {
|
||||
Message::Paste(_entity_opt) => {
|
||||
log::warn!("TODO: PASTE");
|
||||
}
|
||||
Message::PendingComplete(id) => {
|
||||
|
|
@ -1112,10 +1098,10 @@ impl Application for App {
|
|||
move |mut msg_tx| async move {
|
||||
match pending_operation.perform(id, &mut msg_tx).await {
|
||||
Ok(()) => {
|
||||
msg_tx.send(Message::PendingComplete(id)).await;
|
||||
let _ = msg_tx.send(Message::PendingComplete(id)).await;
|
||||
}
|
||||
Err(err) => {
|
||||
msg_tx
|
||||
let _ = msg_tx
|
||||
.send(Message::PendingError(id, err.to_string()))
|
||||
.await;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ use cosmic::{
|
|||
subscription::{self, Subscription},
|
||||
window, Event, Length, Size,
|
||||
},
|
||||
style,
|
||||
widget::{self, segmented_button},
|
||||
Application, ApplicationExt, Element,
|
||||
};
|
||||
|
|
@ -600,12 +599,7 @@ impl Application for App {
|
|||
|
||||
/// Creates a view after each update.
|
||||
fn view(&self) -> Element<Message> {
|
||||
let cosmic_theme::Spacing {
|
||||
space_m,
|
||||
space_s,
|
||||
space_xxs,
|
||||
..
|
||||
} = self.core().system_theme().cosmic().spacing;
|
||||
let cosmic_theme::Spacing { space_xxs, .. } = self.core().system_theme().cosmic().spacing;
|
||||
|
||||
let mut tab_column = widget::column::with_capacity(2);
|
||||
tab_column = tab_column.push(
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ pub enum Operation {
|
|||
impl Operation {
|
||||
/// Perform the operation
|
||||
pub async fn perform(self, id: u64, msg_tx: &mut mpsc::Sender<Message>) -> Result<(), String> {
|
||||
msg_tx.send(Message::PendingProgress(id, 0.0)).await;
|
||||
let _ = msg_tx.send(Message::PendingProgress(id, 0.0)).await;
|
||||
|
||||
//TODO: IF ERROR, RETURN AN Operation THAT CAN UNDO THE CURRENT STATE
|
||||
//TODO: SAFELY HANDLE CANCEL
|
||||
match self {
|
||||
Self::Delete { paths } => {
|
||||
let mut total = paths.len();
|
||||
let total = paths.len();
|
||||
let mut count = 0;
|
||||
for path in paths {
|
||||
tokio::task::spawn_blocking(|| trash::delete(path))
|
||||
|
|
@ -36,7 +36,7 @@ impl Operation {
|
|||
.map_err(err_str)?
|
||||
.map_err(err_str)?;
|
||||
count += 1;
|
||||
msg_tx
|
||||
let _ = msg_tx
|
||||
.send(Message::PendingProgress(
|
||||
id,
|
||||
100.0 * (count as f32) / (total as f32),
|
||||
|
|
@ -45,7 +45,7 @@ impl Operation {
|
|||
}
|
||||
}
|
||||
Self::Restore { paths } => {
|
||||
let mut total = paths.len();
|
||||
let total = paths.len();
|
||||
let mut count = 0;
|
||||
for path in paths {
|
||||
tokio::task::spawn_blocking(|| trash::os_limited::restore_all([path]))
|
||||
|
|
@ -53,7 +53,7 @@ impl Operation {
|
|||
.map_err(err_str)?
|
||||
.map_err(err_str)?;
|
||||
count += 1;
|
||||
msg_tx
|
||||
let _ = msg_tx
|
||||
.send(Message::PendingProgress(
|
||||
id,
|
||||
100.0 * (count as f32) / (total as f32),
|
||||
|
|
@ -66,7 +66,7 @@ impl Operation {
|
|||
}
|
||||
}
|
||||
|
||||
msg_tx.send(Message::PendingProgress(id, 100.0)).await;
|
||||
let _ = msg_tx.send(Message::PendingProgress(id, 100.0)).await;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
12
src/tab.rs
12
src/tab.rs
|
|
@ -25,7 +25,6 @@ use std::{
|
|||
fmt,
|
||||
fs::{self, Metadata},
|
||||
path::PathBuf,
|
||||
process,
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
|
|
@ -566,7 +565,7 @@ impl Tab {
|
|||
};
|
||||
|
||||
println!("{:?}", rect);
|
||||
for (i, item) in items.iter_mut().enumerate() {
|
||||
for (_i, item) in items.iter_mut().enumerate() {
|
||||
item.selected = false;
|
||||
//TODO
|
||||
}
|
||||
|
|
@ -1125,7 +1124,7 @@ impl Tab {
|
|||
mouse_area::MouseArea::new(widget::container(item_view).height(Length::Fill))
|
||||
.on_drag(move |point_opt| Message::Drag(point_opt))
|
||||
.on_press(move |_point_opt| Message::Click(None))
|
||||
.on_release(move |point_opt| Message::Drag(None))
|
||||
.on_release(move |_point_opt| Message::Drag(None))
|
||||
.on_back_press(move |_point_opt| Message::GoPrevious)
|
||||
.on_forward_press(move |_point_opt| Message::GoNext)
|
||||
.show_drag_box(true);
|
||||
|
|
@ -1240,12 +1239,11 @@ mod tests {
|
|||
use tempfile::TempDir;
|
||||
use test_log::test;
|
||||
|
||||
use super::{scan_path, Item, Location, Message, Tab};
|
||||
use super::{scan_path, Location, Message, Tab};
|
||||
use crate::{
|
||||
app::test_utils::{
|
||||
assert_eq_tab_path, assert_eq_tab_path_contents, empty_fs, eq_path_item, filter_dirs,
|
||||
read_dir_sorted, simple_fs, sort_files, tab_click_new, NAME_LEN, NUM_DIRS, NUM_FILES,
|
||||
NUM_HIDDEN, NUM_NESTED,
|
||||
assert_eq_tab_path, empty_fs, eq_path_item, filter_dirs, read_dir_sorted, simple_fs,
|
||||
tab_click_new, NAME_LEN, NUM_DIRS, NUM_FILES, NUM_HIDDEN, NUM_NESTED,
|
||||
},
|
||||
config::{IconSizes, TabConfig},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue