Skip to content

Commit

Permalink
cargo clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
kamiyaa committed Feb 11, 2025
1 parent e1ea621 commit d012034
Show file tree
Hide file tree
Showing 24 changed files with 40 additions and 45 deletions.
7 changes: 3 additions & 4 deletions src/commands/delete_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@ fn delete_files(
permanently: bool,
) -> AppResult {
let file_op = FileOperation::Delete;
let options = {
let mut options = FileOperationOptions::default();
options.permanently = !app_state.config.use_trash || permanently;
options
let options = FileOperationOptions {
permanently: !app_state.config.use_trash || permanently,
..Default::default()
};

let dest = path::PathBuf::new();
Expand Down
16 changes: 8 additions & 8 deletions src/config/theme/tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ impl From<TabThemeCharsRaw> for TabThemeChars {
#[derive(Clone, Debug)]
pub struct TabThemeCharsInference {
pub tab_divider_length: usize,
pub tab_prefix_i_length: usize,
pub tab_postfix_i_length: usize,
pub tab_prefix_a_length: usize,
pub tab_postfix_a_length: usize,
pub _tab_prefix_i_length: usize,
pub _tab_postfix_i_length: usize,
pub _tab_prefix_a_length: usize,
pub _tab_postfix_a_length: usize,
pub scroll_front_static_length: usize,
pub scroll_back_static_length: usize,
pub active_tab_extra_width: usize,
Expand All @@ -84,10 +84,10 @@ impl TabThemeCharsInference {
fn from_chars(chars: &TabThemeChars) -> Self {
Self {
tab_divider_length: chars.divider.width(),
tab_prefix_i_length: chars.prefix_i.width(),
tab_prefix_a_length: chars.prefix_a.width(),
tab_postfix_i_length: chars.postfix_i.width(),
tab_postfix_a_length: chars.postfix_a.width(),
_tab_prefix_i_length: chars.prefix_i.width(),
_tab_prefix_a_length: chars.prefix_a.width(),
_tab_postfix_i_length: chars.postfix_i.width(),
_tab_postfix_a_length: chars.postfix_a.width(),
scroll_front_static_length: chars.scroll_front_prefix.width()
+ chars.scroll_front_postfix.width()
+ chars.scroll_front_prestring.width()
Expand Down
4 changes: 2 additions & 2 deletions src/preview/preview_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct FilePreview {
pub status: std::process::ExitStatus,
pub output: String,
pub index: usize,
pub modified: time::SystemTime,
pub _modified: time::SystemTime,
}

impl std::convert::From<Output> for FilePreview {
Expand All @@ -35,7 +35,7 @@ impl std::convert::From<Output> for FilePreview {
Self {
status,
output: s2,
modified,
_modified: modified,
index: 0,
}
}
Expand Down
9 changes: 5 additions & 4 deletions src/types/command/impl_appexecute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ impl AppExecute for Command {
Self::CopyFilePath { all_selected: true } => file_ops::copy_filepath(app_state, true),
Self::CopyDirPath => file_ops::copy_dirpath(app_state),
Self::SymlinkFiles { relative } => {
let mut options = FileOperationOptions::default();
options.symlink = true;
options.symlink_relative = *relative;

let options = FileOperationOptions {
_symlink: true,
symlink_relative: *relative,
..Default::default()
};
file_ops::create_io_task(app_state, FileOperation::Symlink, options)
}
Self::PasteFiles { options } => file_ops::create_io_paste_task(app_state, *options),
Expand Down
2 changes: 1 addition & 1 deletion src/types/io/file_operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl std::fmt::Display for FileOperation {
#[derive(Clone, Copy, Debug, Default)]
pub struct FileOperationOptions {
// symlink
pub symlink: bool,
pub _symlink: bool,
pub symlink_relative: bool,

// cut, copy
Expand Down
1 change: 0 additions & 1 deletion src/types/state/preview_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ impl PreviewState {
///
/// This function shall be called each time a change of Joshuto's preview can be expected.
/// (As of now, it's called in each cycle of the main loop.)
fn backend_rect(config: &AppConfig, backend: &AppBackend) -> io::Result<Rect> {
let size = backend.terminal_ref().size()?;
let area = Rect {
Expand Down
6 changes: 1 addition & 5 deletions src/ui/tab_list_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,7 @@ fn factor_tab_bar_sequence(
//## (=> we need scrolling)
//####################################################################
let scroll_tags_width = config.inference.calc_scroll_tags_width(tab_num);
let scrollable_width = if scroll_tags_width > available_width {
0
} else {
available_width - scroll_tags_width
};
let scrollable_width = available_width.saturating_sub(scroll_tags_width);

let carousel_labels = if all_labels_as_long[current_index].width()
+ config.inference.active_tab_extra_width
Expand Down
2 changes: 1 addition & 1 deletion src/ui/views/tui_command_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl<'a> TuiCommandMenu<'a> {
}
}

impl<'a> Widget for TuiCommandMenu<'a> {
impl Widget for TuiCommandMenu<'_> {
fn render(self, area: Rect, buf: &mut Buffer) {
TuiView::new(self.app_state).render(area, buf);

Expand Down
4 changes: 2 additions & 2 deletions src/ui/views/tui_folder_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl<'a> TuiFolderViewBorders<'a> {
}
}

impl<'a> Widget for TuiFolderViewBorders<'a> {
impl Widget for TuiFolderViewBorders<'_> {
fn render(self, area: Rect, buf: &mut Buffer) {
let block = Block::default().borders(Borders::ALL);
let inner = block.inner(area);
Expand Down Expand Up @@ -113,7 +113,7 @@ impl<'a> TuiFolderView<'a> {
}
}

impl<'a> Widget for TuiFolderView<'a> {
impl Widget for TuiFolderView<'_> {
fn render(self, area: Rect, buf: &mut Buffer) {
let display_options = &self.app_state.config.display_options;

Expand Down
2 changes: 1 addition & 1 deletion src/ui/views/tui_hsplit_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl<'a> TuiHSplitView<'a> {
}
}

impl<'a> Widget for TuiHSplitView<'a> {
impl Widget for TuiHSplitView<'_> {
fn render(self, area: Rect, buf: &mut Buffer) {
let tab_state = self.app_state.state.tab_state_ref();

Expand Down
2 changes: 1 addition & 1 deletion src/ui/views/tui_minimal_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl<'a> TuiMinimalView<'a> {
}
}

impl<'a> Widget for TuiMinimalView<'a> {
impl Widget for TuiMinimalView<'_> {
fn render(self, area: Rect, buf: &mut Buffer) {
let tab_state = self.app_state.state.tab_state_ref();

Expand Down
2 changes: 1 addition & 1 deletion src/ui/views/tui_progress_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl<'a> TuiProgressView<'a> {
}
}

impl<'a> Widget for TuiProgressView<'a> {
impl Widget for TuiProgressView<'_> {
fn render(self, area: Rect, buf: &mut Buffer) {
let f_size = area;

Expand Down
2 changes: 1 addition & 1 deletion src/ui/views/tui_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a> TuiView<'a> {
}
}

impl<'a> Widget for TuiView<'a> {
impl Widget for TuiView<'_> {
fn render(self, area: Rect, buf: &mut Buffer) {
let display_options = &self.app_state.config.display_options;
match display_options.mode {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/views/tui_worker_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ impl<'a> TuiWorkerView<'a> {
}
}

impl<'a> Widget for TuiWorkerView<'a> {
impl Widget for TuiWorkerView<'_> {
fn render(self, area: Rect, buf: &mut Buffer) {
if area.height == 0 {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/widgets/tui_dirlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl<'a> TuiDirList<'a> {
}
}

impl<'a> Widget for TuiDirList<'a> {
impl Widget for TuiDirList<'_> {
fn render(self, area: Rect, buf: &mut Buffer) {
if area.width < 4 || area.height < 1 {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/widgets/tui_dirlist_detailed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl<'a> TuiDirListDetailed<'a> {
}
}

impl<'a> Widget for TuiDirListDetailed<'a> {
impl Widget for TuiDirListDetailed<'_> {
fn render(self, area: Rect, buf: &mut Buffer) {
if area.width < 4 || area.height < 1 {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/widgets/tui_file_preview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl<'a> TuiFilePreview<'a> {
}
}

impl<'a> Widget for TuiFilePreview<'a> {
impl Widget for TuiFilePreview<'_> {
fn render(self, area: Rect, buf: &mut Buffer) {
self.render_text_preview(area, buf, self.preview.output.as_str());
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/widgets/tui_footer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl<'a> TuiFooter<'a> {
}
}

impl<'a> Widget for TuiFooter<'a> {
impl Widget for TuiFooter<'_> {
fn render(self, area: Rect, buf: &mut Buffer) {
let visual_mode_style = Style::default().fg(Color::Black).bg(Color::LightRed);
let mode_style = Style::default().fg(Color::Cyan);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/widgets/tui_help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl<'a> TuiHelp<'a> {
}
}

impl<'a> Widget for TuiHelp<'a> {
impl Widget for TuiHelp<'_> {
fn render(self, area: Rect, buf: &mut Buffer) {
// Subtracting 2 because we'll draw a title at the top and some
// additional information at the bottom of the page
Expand Down
6 changes: 3 additions & 3 deletions src/ui/widgets/tui_io_tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ impl<'a> TuiIoTasks<'a> {
}
}

impl<'a> Widget for TuiIoTasks<'a> {
impl Widget for TuiIoTasks<'_> {
fn render(self, area: Rect, buf: &mut Buffer) {
if area.height < 7 {
return;
Expand Down Expand Up @@ -64,7 +64,7 @@ impl<'a> TuiCurrentWorker<'a> {
}
}

impl<'a> Widget for TuiCurrentWorker<'a> {
impl Widget for TuiCurrentWorker<'_> {
fn render(self, area: Rect, buf: &mut Buffer) {
let top = area.top();
let left = area.left();
Expand Down Expand Up @@ -121,7 +121,7 @@ impl<'a> TuiWorkerQueue<'a> {
}
}

impl<'a> Widget for TuiWorkerQueue<'a> {
impl Widget for TuiWorkerQueue<'_> {
fn render(self, area: Rect, buf: &mut Buffer) {
let top = area.top();
let left = area.left();
Expand Down
2 changes: 1 addition & 1 deletion src/ui/widgets/tui_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ impl<'a> TuiMenu<'a> {
}
}

impl<'a> Widget for TuiMenu<'a> {
impl Widget for TuiMenu<'_> {
fn render(self, area: Rect, buf: &mut Buffer) {
let style = Style::default().fg(Color::Reset).bg(Color::Reset);

Expand Down
2 changes: 1 addition & 1 deletion src/ui/widgets/tui_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl<'a> TuiMessage<'a> {
}
}

impl<'a> Widget for TuiMessage<'a> {
impl Widget for TuiMessage<'_> {
fn render(self, area: Rect, buf: &mut Buffer) {
if area.width < 4 || area.height < 1 {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/widgets/tui_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl<'a> TuiMultilineText<'a> {
}
}

impl<'a> Widget for TuiMultilineText<'a> {
impl Widget for TuiMultilineText<'_> {
fn render(self, area: Rect, buf: &mut Buffer) {
let area_left = area.left();
let area_top = area.top();
Expand Down
2 changes: 1 addition & 1 deletion src/ui/widgets/tui_topbar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl<'a> TuiTopBar<'a> {
}
}

impl<'a> Widget for TuiTopBar<'a> {
impl Widget for TuiTopBar<'_> {
fn render(self, area: Rect, buf: &mut Buffer) {
let name_width = USERNAME.as_str().len() + HOSTNAME.as_str().len() + 2;

Expand Down

0 comments on commit d012034

Please sign in to comment.