fix(clippy): unneccessary >= y + 1 or x - 1 >=

This commit is contained in:
a-kenji 2021-02-18 14:16:38 +01:00
parent c0a0af3133
commit dc7e980a05

View File

@ -1,4 +1,5 @@
//! `Tab`s holds multiple panes. It tracks their coordinates (x/y) and size, as well as how they should be resized //! `Tab`s holds multiple panes. It tracks their coordinates (x/y) and size,
//! as well as how they should be resized
use crate::common::{AppInstruction, SenderWithContext}; use crate::common::{AppInstruction, SenderWithContext};
use crate::panes::{PaneId, PositionAndSize, TerminalPane}; use crate::panes::{PaneId, PositionAndSize, TerminalPane};
@ -296,9 +297,8 @@ impl Tab {
* terminal_to_check.columns(); * terminal_to_check.columns();
let terminal_can_be_split = terminal_to_check.columns() >= MIN_TERMINAL_WIDTH let terminal_can_be_split = terminal_to_check.columns() >= MIN_TERMINAL_WIDTH
&& terminal_to_check.rows() >= MIN_TERMINAL_HEIGHT && terminal_to_check.rows() >= MIN_TERMINAL_HEIGHT
&& ((terminal_to_check.columns() >= terminal_to_check.min_width() * 2 + 1) && ((terminal_to_check.columns() > terminal_to_check.min_width() * 2)
|| (terminal_to_check.rows() || (terminal_to_check.rows() > terminal_to_check.min_height() * 2));
>= terminal_to_check.min_height() * 2 + 1));
if terminal_can_be_split && terminal_size > current_largest_terminal_size { if terminal_can_be_split && terminal_size > current_largest_terminal_size {
(terminal_size, Some(*id_of_terminal_to_check)) (terminal_size, Some(*id_of_terminal_to_check))
} else { } else {
@ -321,7 +321,7 @@ impl Tab {
y: terminal_to_split.y(), y: terminal_to_split.y(),
}; };
if terminal_to_split.rows() * CURSOR_HEIGHT_WIDTH_RATIO > terminal_to_split.columns() if terminal_to_split.rows() * CURSOR_HEIGHT_WIDTH_RATIO > terminal_to_split.columns()
&& terminal_to_split.rows() >= terminal_to_split.min_height() * 2 + 1 && terminal_to_split.rows() > terminal_to_split.min_height() * 2
{ {
// FIXME: This could use a second look // FIXME: This could use a second look
if let PaneId::Terminal(term_pid) = pid { if let PaneId::Terminal(term_pid) = pid {
@ -343,7 +343,7 @@ impl Tab {
} }
self.active_terminal = Some(pid); self.active_terminal = Some(pid);
} }
} else if terminal_to_split.columns() >= terminal_to_split.min_width() * 2 + 1 { } else if terminal_to_split.columns() > terminal_to_split.min_width() * 2 {
// FIXME: This could use a second look // FIXME: This could use a second look
if let PaneId::Terminal(term_pid) = pid { if let PaneId::Terminal(term_pid) = pid {
let (left_winsize, right_winsize) = split_vertically_with_gap(&terminal_ws); let (left_winsize, right_winsize) = split_vertically_with_gap(&terminal_ws);