Skip to content

Commit 27d420f

Browse files
committed
Applied all suggestions by Clippy
1 parent ee45b19 commit 27d420f

7 files changed

Lines changed: 18 additions & 18 deletions

File tree

crates/termal-alignment/src/alignment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ impl Alignment {
184184
match spec {
185185
// Note: the rank in a RefSpec is 0-based. The conversion from user-land is done in
186186
// app.rs.
187-
RefSpec::Rank(rk) if rk >= self.num_seq() as usize => {
187+
RefSpec::Rank(rk) if rk >= self.num_seq() => {
188188
return Err(RefSpecError::RefTooLarge(self.num_seq()));
189189
}
190190
_ => self.ref_spec = spec,

crates/termal-export/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn compute_layout(aln: &Alignment, opts: &ExportOpts) -> Layout {
4242
Layout {
4343
grid_width: hdr_txt_width + aln.aln_len() as f32 * opts.cell_width,
4444
grid_height: aln.num_seq() as f32 * opts.cell_height,
45-
hdr_txt_width: hdr_txt_width,
45+
hdr_txt_width,
4646
}
4747
}
4848

@@ -57,7 +57,7 @@ impl Default for ExportOpts {
5757
residue_font_size: 14,
5858
ascent_corr: 12.0,
5959
char_width: 8.0,
60-
colormap: colormap,
60+
colormap,
6161
margin_x: 10.0,
6262
margin_y: 10.0,
6363
cell_frames: false,

crates/termal-export/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ fn main() -> Result<()> {
132132
cell_width: args.cell_width,
133133
cell_height: args.cell_height,
134134
residue_font_size: args.residue_font_size,
135-
colormap: colormap,
135+
colormap,
136136
ascent_corr: args.ascent_corr,
137137
margin_x: args.margin_x,
138138
margin_y: args.margin_y,

crates/termal/src/app.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,8 @@ impl App {
352352
}
353353

354354
fn next_match_expect(
355-
reverse_ordering: &Vec<usize>,
356-
ordering: &Vec<usize>,
355+
reverse_ordering: &[usize],
356+
ordering: &[usize],
357357
num_seq: usize,
358358
matches_by_rank: &HashMap<usize, Vec<MatchPosition>>,
359359
cur_match: (usize, usize),
@@ -376,8 +376,8 @@ impl App {
376376
}
377377

378378
fn previous_match_expect(
379-
reverse_ordering: &Vec<usize>,
380-
ordering: &Vec<usize>,
379+
reverse_ordering: &[usize],
380+
ordering: &[usize],
381381
num_seq: usize,
382382
matches_by_rank: &HashMap<usize, Vec<MatchPosition>>,
383383
cur_match: (usize, usize),
@@ -500,7 +500,7 @@ impl App {
500500
if let Some((rank, match_ndx)) = seq_state.current {
501501
let mut current_match_num = 0;
502502
for cur_rank in &self.ordering {
503-
if let Some(matches) = seq_state.matches_by_rank.get(&cur_rank) {
503+
if let Some(matches) = seq_state.matches_by_rank.get(cur_rank) {
504504
if *cur_rank != rank {
505505
current_match_num += matches.len();
506506
} else {
@@ -595,7 +595,7 @@ impl App {
595595
}
596596
}
597597

598-
fn ordered_hdr_matches(&self, match_ranks: &Vec<usize>) -> Vec<usize> {
598+
fn ordered_hdr_matches(&self, match_ranks: &[usize]) -> Vec<usize> {
599599
let mut screenlines: Vec<usize> = match_ranks
600600
.iter()
601601
.map(|r| self.reverse_ordering[*r])
@@ -724,7 +724,7 @@ impl App {
724724
// -1 <= user is 1-based
725725
self.alignment.set_ref_spec(RefSpec::Rank(rank - 1))
726726
}
727-
Ok(rank) if rank == 0 => {
727+
Ok(0) => {
728728
Err(RefSpecError::ZeroRef)
729729
}
730730
// usize cannot be < 0

crates/termal/src/runner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ pub fn run() -> Result<(), TermalError> {
177177
let mut user_ordering = match cli.user_order {
178178
Some(ref fname) => {
179179
// TODO: should be called from_path()
180-
let get_ord_vec = read_user_ordering(&fname);
180+
let get_ord_vec = read_user_ordering(fname);
181181
match get_ord_vec {
182182
Ok(ord_vec) => Some(ord_vec),
183183
Err(_) => {

crates/termal/src/ui/key_handling.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ fn handle_label_search(ui: &mut UI, key_event: KeyEvent, pattern: &str) {
132132
KeyCode::Enter => {
133133
ui.app.regex_search_labels(pattern);
134134
ui.input_mode = InputMode::Normal;
135-
if let Some(_) = &ui.app.search_state {
135+
if ui.app.search_state.is_some() {
136136
ui.jump_to_next_match(0);
137137
}
138138
}
@@ -348,7 +348,7 @@ fn dispatch_command(ui: &mut UI, key_event: KeyEvent, count_arg: Option<usize>)
348348

349349
// To search matches
350350
KeyCode::Char('n') => ui.jump_to_next_match(count as i16),
351-
KeyCode::Char('p') => ui.jump_to_next_match(-1 * count as i16),
351+
KeyCode::Char('p') => ui.jump_to_next_match(-(count as i16)),
352352
KeyCode::Enter => ui.jump_to_current_match(),
353353

354354
// Left Pane width

crates/termal/src/ui/render.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ fn make_layout(f: &Frame, ui: &UI) -> Panes {
259259
let lbl_pane = Layout::new(
260260
Direction::Horizontal,
261261
vec![
262-
Constraint::Length(lbl_num_pane_num_cols.try_into().unwrap()),
262+
Constraint::Length(lbl_num_pane_num_cols),
263263
Constraint::Fill(1),
264264
Constraint::Length(3),
265265
],
@@ -405,12 +405,12 @@ fn render_alignment_pane(f: &mut Frame, aln_chunk: Rect, ui: &UI) {
405405

406406
f.render_widget(aln_block, aln_chunk);
407407

408-
let style_lut = build_style_lut(&ui);
408+
let style_lut = build_style_lut(ui);
409409

410410
match ui.zoom_level {
411411
ZoomLevel::ZoomedIn => {
412412
let pane = SeqPane {
413-
app: &ui.app,
413+
app: ui.app,
414414
sequences: &ui.app.alignment.sequences,
415415
ordering: &ui.app.ordering,
416416
top_i: ui.top_line as usize,
@@ -423,7 +423,7 @@ fn render_alignment_pane(f: &mut Frame, aln_chunk: Rect, ui: &UI) {
423423
ZoomLevel::ZoomedOut | ZoomLevel::ZoomedOutAR => {
424424
let zoombox_color = ui.get_zoombox_color();
425425
let pane = SeqPaneZoomedOut {
426-
app: &ui.app,
426+
app: ui.app,
427427
sequences: &ui.app.alignment.sequences,
428428
ordering: &ui.app.ordering,
429429
retained_rows: &retained_seq_ndx(ui),

0 commit comments

Comments
 (0)