From 67d2673cae60954e8287c2a1f58a21a56e066afb Mon Sep 17 00:00:00 2001 From: a-kenji Date: Fri, 10 Jun 2022 20:03:13 +0200 Subject: add(style): add trailing comma in match blocks (#1483) This makes it easier to distinguish from normal blocks --- default-plugins/compact-bar/src/main.rs | 16 ++++++++-------- default-plugins/status-bar/src/first_line.rs | 8 ++++---- default-plugins/status-bar/src/main.rs | 18 +++++++++--------- default-plugins/status-bar/src/second_line.rs | 8 ++++---- default-plugins/status-bar/src/tip/cache.rs | 6 +++--- default-plugins/strider/src/main.rs | 20 ++++++++++---------- default-plugins/strider/src/state.rs | 2 +- default-plugins/tab-bar/src/main.rs | 16 ++++++++-------- 8 files changed, 47 insertions(+), 47 deletions(-) (limited to 'default-plugins') diff --git a/default-plugins/compact-bar/src/main.rs b/default-plugins/compact-bar/src/main.rs index 3e875a269..cf85d5d9b 100644 --- a/default-plugins/compact-bar/src/main.rs +++ b/default-plugins/compact-bar/src/main.rs @@ -49,23 +49,23 @@ impl ZellijPlugin for State { } else { eprintln!("Could not find active tab."); } - } + }, Event::Mouse(me) => match me { Mouse::LeftClick(_, col) => { self.mouse_click_pos = col; self.should_render = true; - } + }, Mouse::ScrollUp(_) => { switch_tab_to(min(self.active_tab_idx + 1, self.tabs.len()) as u32); - } + }, Mouse::ScrollDown(_) => { switch_tab_to(max(self.active_tab_idx.saturating_sub(1), 1) as u32); - } - _ => {} + }, + _ => {}, }, _ => { eprintln!("Got unrecognized event: {:?}", event); - } + }, } } @@ -130,10 +130,10 @@ impl ZellijPlugin for State { match background { PaletteColor::Rgb((r, g, b)) => { println!("{}\u{1b}[48;2;{};{};{}m\u{1b}[0K", s, r, g, b); - } + }, PaletteColor::EightBit(color) => { println!("{}\u{1b}[48;5;{}m\u{1b}[0K", s, color); - } + }, } self.should_render = false; } diff --git a/default-plugins/status-bar/src/first_line.rs b/default-plugins/status-bar/src/first_line.rs index dc7b95ecc..a4fa91b86 100644 --- a/default-plugins/status-bar/src/first_line.rs +++ b/default-plugins/status-bar/src/first_line.rs @@ -261,16 +261,16 @@ fn single_letter_ctrl_key( match key.mode { CtrlKeyMode::Unselected => { unselected_mode_shortcut_single_letter(letter_shortcut, palette, separator) - } + }, CtrlKeyMode::UnselectedAlternate => { unselected_alternate_mode_shortcut_single_letter(letter_shortcut, palette, separator) - } + }, CtrlKeyMode::Selected => { selected_mode_shortcut_single_letter(letter_shortcut, palette, separator) - } + }, CtrlKeyMode::Disabled => { disabled_mode_shortcut(&format!(" {}", letter_shortcut), palette, separator) - } + }, } } diff --git a/default-plugins/status-bar/src/main.rs b/default-plugins/status-bar/src/main.rs index 4a53fed8a..23ee3de76 100644 --- a/default-plugins/status-bar/src/main.rs +++ b/default-plugins/status-bar/src/main.rs @@ -237,21 +237,21 @@ impl ZellijPlugin for State { match event { Event::ModeUpdate(mode_info) => { self.mode_info = mode_info; - } + }, Event::TabUpdate(tabs) => { self.tabs = tabs; - } + }, Event::CopyToClipboard(copy_destination) => { self.text_copy_destination = Some(copy_destination); - } + }, Event::SystemClipboardFailure => { self.display_system_clipboard_failure = true; - } + }, Event::InputReceived => { self.text_copy_destination = None; self.display_system_clipboard_failure = false; - } - _ => {} + }, + _ => {}, } } @@ -284,10 +284,10 @@ impl ZellijPlugin for State { match background { PaletteColor::Rgb((r, g, b)) => { println!("{}\u{1b}[48;2;{};{};{}m\u{1b}[0K", first_line, r, g, b); - } + }, PaletteColor::EightBit(color) => { println!("{}\u{1b}[48;5;{}m\u{1b}[0K", first_line, color); - } + }, } println!("\u{1b}[m{}\u{1b}[0K", second_line); } @@ -319,7 +319,7 @@ impl State { InputMode::Normal => floating_panes_are_visible(&self.mode_info.style.colors), InputMode::Locked => { locked_floating_panes_are_visible(&self.mode_info.style.colors) - } + }, _ => keybinds(&self.mode_info, &self.tip_name, cols), } } else { diff --git a/default-plugins/status-bar/src/second_line.rs b/default-plugins/status-bar/src/second_line.rs index 9b6540336..56a71e4b5 100644 --- a/default-plugins/status-bar/src/second_line.rs +++ b/default-plugins/status-bar/src/second_line.rs @@ -224,7 +224,7 @@ fn shortened_shortcut_list(help: &ModeInfo, tip: TipFn) -> LinePart { InputMode::Tmux => short_tmux_mode_indication(help), InputMode::RenamePane => { shortened_shortcut_list_nonstandard_mode(select_pane_shortcut)(help) - } + }, _ => shortened_shortcut_list_nonstandard_mode(confirm_pane_selection)(help), } } @@ -279,7 +279,7 @@ fn best_effort_shortcut_list(help: &ModeInfo, tip: TipFn, max_len: usize) -> Lin } else { LinePart::default() } - } + }, InputMode::Locked => { let line_part = locked_interface_indication(help.style.colors); if line_part.len <= max_len { @@ -287,11 +287,11 @@ fn best_effort_shortcut_list(help: &ModeInfo, tip: TipFn, max_len: usize) -> Lin } else { LinePart::default() } - } + }, InputMode::Tmux => best_effort_tmux_shortcut_list(help, max_len), InputMode::RenamePane => { best_effort_shortcut_list_nonstandard_mode(select_pane_shortcut)(help, max_len) - } + }, _ => best_effort_shortcut_list_nonstandard_mode(confirm_pane_selection)(help, max_len), } } diff --git a/default-plugins/status-bar/src/tip/cache.rs b/default-plugins/status-bar/src/tip/cache.rs index dece82437..e62e658d9 100644 --- a/default-plugins/status-bar/src/tip/cache.rs +++ b/default-plugins/status-bar/src/tip/cache.rs @@ -47,7 +47,7 @@ impl LocalCache { }); } Err(LocalCacheError::Serde(err)) - } + }, } } @@ -64,7 +64,7 @@ impl LocalCache { let metadata = LocalCache::from_json(&json_cache)?; Ok(LocalCache { path, metadata }) - } + }, Err(e) => Err(LocalCacheError::IoPath(e, path)), } } @@ -77,7 +77,7 @@ impl LocalCache { file.write_all(json_cache.as_bytes()) .map_err(LocalCacheError::Io)?; Ok(()) - } + }, Err(e) => Err(LocalCacheError::Serde(e)), } } diff --git a/default-plugins/strider/src/main.rs b/default-plugins/strider/src/main.rs index 4ce0b0434..22ca1c614 100644 --- a/default-plugins/strider/src/main.rs +++ b/default-plugins/strider/src/main.rs @@ -24,15 +24,15 @@ impl ZellijPlugin for State { Event::Key(key) => match key { Key::Up | Key::Char('k') => { *self.selected_mut() = self.selected().saturating_sub(1); - } + }, Key::Down | Key::Char('j') => { let next = self.selected().saturating_add(1); *self.selected_mut() = min(self.files.len().saturating_sub(1), next); - } + }, Key::Right | Key::Char('\n') | Key::Char('l') if !self.files.is_empty() => { self.traverse_dir_or_open_file(); self.ev_history.clear(); - } + }, Key::Left | Key::Char('h') => { if self.path.components().count() > 2 { // don't descend into /host @@ -42,11 +42,11 @@ impl ZellijPlugin for State { self.path.pop(); refresh_directory(self); } - } + }, Key::Char('.') => { self.toggle_hidden_files(); refresh_directory(self); - } + }, _ => (), }, @@ -54,10 +54,10 @@ impl ZellijPlugin for State { Mouse::ScrollDown(_) => { let next = self.selected().saturating_add(1); *self.selected_mut() = min(self.files.len().saturating_sub(1), next); - } + }, Mouse::ScrollUp(_) => { *self.selected_mut() = self.selected().saturating_sub(1); - } + }, Mouse::Release(line, _) => { if line < 0 { return; @@ -75,12 +75,12 @@ impl ZellijPlugin for State { if should_select && self.scroll() + (line as usize) < self.files.len() { *self.selected_mut() = self.scroll() + (line as usize); } - } - _ => {} + }, + _ => {}, }, _ => { dbg!("Unknown event {:?}", event); - } + }, } } diff --git a/default-plugins/strider/src/state.rs b/default-plugins/strider/src/state.rs index 81d44a61d..05ede0df7 100644 --- a/default-plugins/strider/src/state.rs +++ b/default-plugins/strider/src/state.rs @@ -39,7 +39,7 @@ impl State { FsEntry::Dir(p, _) => { self.path = p; refresh_directory(self); - } + }, FsEntry::File(p, _) => open_file(p.strip_prefix(ROOT).unwrap()), } } diff --git a/default-plugins/tab-bar/src/main.rs b/default-plugins/tab-bar/src/main.rs index a6647fcef..b11ab87c2 100644 --- a/default-plugins/tab-bar/src/main.rs +++ b/default-plugins/tab-bar/src/main.rs @@ -49,23 +49,23 @@ impl ZellijPlugin for State { } else { eprintln!("Could not find active tab."); } - } + }, Event::Mouse(me) => match me { Mouse::LeftClick(_, col) => { self.mouse_click_pos = col; self.should_render = true; - } + }, Mouse::ScrollUp(_) => { switch_tab_to(min(self.active_tab_idx + 1, self.tabs.len()) as u32); - } + }, Mouse::ScrollDown(_) => { switch_tab_to(max(self.active_tab_idx.saturating_sub(1), 1) as u32); - } - _ => {} + }, + _ => {}, }, _ => { eprintln!("Got unrecognized event: {:?}", event); - } + }, } } @@ -129,10 +129,10 @@ impl ZellijPlugin for State { match background { PaletteColor::Rgb((r, g, b)) => { println!("{}\u{1b}[48;2;{};{};{}m\u{1b}[0K", s, r, g, b); - } + }, PaletteColor::EightBit(color) => { println!("{}\u{1b}[48;5;{}m\u{1b}[0K", s, color); - } + }, } self.should_render = false; } -- cgit v1.2.3