aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-11-12 03:25:26 -0500
committerJesse Luehrs <doy@tozt.net>2021-11-12 03:25:26 -0500
commita0612445e3225324276632e38928e505307d0a96 (patch)
tree2e4bb3e2b7d7b37fd604e792d5b005571b137a0b
parentf9f4633e9ecf39a5e706323e33be5feaf578ae8d (diff)
downloadvt100-rust-a0612445e3225324276632e38928e505307d0a96.tar.gz
vt100-rust-a0612445e3225324276632e38928e505307d0a96.zip
clippy
-rw-r--r--src/cell.rs2
-rw-r--r--src/grid.rs4
-rw-r--r--src/lib.rs1
-rw-r--r--src/row.rs2
-rw-r--r--src/screen.rs32
-rw-r--r--src/term.rs25
6 files changed, 34 insertions, 32 deletions
diff --git a/src/cell.rs b/src/cell.rs
index aa1b718..7262c8d 100644
--- a/src/cell.rs
+++ b/src/cell.rs
@@ -11,7 +11,7 @@ pub struct Cell {
}
#[allow(clippy::collapsible_if)]
-impl PartialEq<Cell> for Cell {
+impl PartialEq<Self> for Cell {
fn eq(&self, other: &Self) -> bool {
if self.len != other.len {
return false;
diff --git a/src/grid.rs b/src/grid.rs
index 858f646..3dd8312 100644
--- a/src/grid.rs
+++ b/src/grid.rs
@@ -187,7 +187,7 @@ impl Grid {
for row in self.visible_rows() {
row.write_contents(contents, 0, self.size.cols, wrapping);
if !row.wrapped() {
- contents.push_str("\n");
+ contents.push('\n');
}
wrapping = row.wrapped();
}
@@ -551,7 +551,7 @@ impl Grid {
pub fn set_origin_mode(&mut self, mode: bool) {
self.origin_mode = mode;
- self.set_pos(Pos { row: 0, col: 0 })
+ self.set_pos(Pos { row: 0, col: 0 });
}
pub fn row_inc_clamp(&mut self, count: u16) {
diff --git a/src/lib.rs b/src/lib.rs
index 8a85cae..2397b3f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -39,6 +39,7 @@
#![warn(clippy::nursery)]
#![allow(clippy::cognitive_complexity)]
#![allow(clippy::missing_const_for_fn)]
+#![allow(clippy::missing_panics_doc)]
#![allow(clippy::single_match)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::too_many_lines)]
diff --git a/src/row.rs b/src/row.rs
index 16c59a4..b7ae2c4 100644
--- a/src/row.rs
+++ b/src/row.rs
@@ -276,7 +276,7 @@ impl Row {
>= self.cols() - if prev_first_cell.is_wide() { 1 } else { 0 }
{
let mut cell_contents = prev_first_cell.contents();
- let need_erase = if cell_contents == "" {
+ let need_erase = if cell_contents.is_empty() {
cell_contents = " ".to_string();
true
} else {
diff --git a/src/screen.rs b/src/screen.rs
index 300e05d..82d20b2 100644
--- a/src/screen.rs
+++ b/src/screen.rs
@@ -1092,7 +1092,7 @@ impl Screen {
fn sm(&mut self, params: &vte::Params) {
// nothing, i think?
if log::log_enabled!(log::Level::Debug) {
- log::debug!("unhandled SM mode: {}", param_str(params))
+ log::debug!("unhandled SM mode: {}", param_str(params));
}
}
@@ -1106,17 +1106,17 @@ impl Screen {
&[25] => self.clear_mode(MODE_HIDE_CURSOR),
&[47] => self.enter_alternate_grid(),
&[1000] => {
- self.set_mouse_mode(MouseProtocolMode::PressRelease)
+ self.set_mouse_mode(MouseProtocolMode::PressRelease);
}
&[1002] => {
- self.set_mouse_mode(MouseProtocolMode::ButtonMotion)
+ self.set_mouse_mode(MouseProtocolMode::ButtonMotion);
}
&[1003] => self.set_mouse_mode(MouseProtocolMode::AnyMotion),
&[1005] => {
- self.set_mouse_encoding(MouseProtocolEncoding::Utf8)
+ self.set_mouse_encoding(MouseProtocolEncoding::Utf8);
}
&[1006] => {
- self.set_mouse_encoding(MouseProtocolEncoding::Sgr)
+ self.set_mouse_encoding(MouseProtocolEncoding::Sgr);
}
&[1049] => {
self.decsc();
@@ -1142,7 +1142,7 @@ impl Screen {
fn rm(&mut self, params: &vte::Params) {
// nothing, i think?
if log::log_enabled!(log::Level::Debug) {
- log::debug!("unhandled RM mode: {}", param_str(params))
+ log::debug!("unhandled RM mode: {}", param_str(params));
}
}
@@ -1158,19 +1158,19 @@ impl Screen {
self.exit_alternate_grid();
}
&[1000] => {
- self.clear_mouse_mode(MouseProtocolMode::PressRelease)
+ self.clear_mouse_mode(MouseProtocolMode::PressRelease);
}
&[1002] => {
- self.clear_mouse_mode(MouseProtocolMode::ButtonMotion)
+ self.clear_mouse_mode(MouseProtocolMode::ButtonMotion);
}
&[1003] => {
- self.clear_mouse_mode(MouseProtocolMode::AnyMotion)
+ self.clear_mouse_mode(MouseProtocolMode::AnyMotion);
}
&[1005] => {
- self.clear_mouse_encoding(MouseProtocolEncoding::Utf8)
+ self.clear_mouse_encoding(MouseProtocolEncoding::Utf8);
}
&[1006] => {
- self.clear_mouse_encoding(MouseProtocolEncoding::Sgr)
+ self.clear_mouse_encoding(MouseProtocolEncoding::Sgr);
}
&[1049] => {
self.exit_alternate_grid();
@@ -1374,7 +1374,7 @@ impl Screen {
impl vte::Perform for Screen {
fn print(&mut self, c: char) {
- self.text(c)
+ self.text(c);
}
fn execute(&mut self, b: u8) {
@@ -1450,7 +1450,7 @@ impl vte::Perform for Screen {
"unhandled csi sequence: CSI {} {}",
param_str(params),
c
- )
+ );
}
}
},
@@ -1465,7 +1465,7 @@ impl vte::Perform for Screen {
"unhandled csi sequence: CSI ? {} {}",
param_str(params),
c
- )
+ );
}
}
},
@@ -1476,7 +1476,7 @@ impl vte::Perform for Screen {
i,
param_str(params),
c
- )
+ );
}
}
}
@@ -1492,7 +1492,7 @@ impl vte::Perform for Screen {
log::debug!(
"unhandled osc sequence: OSC {}",
osc_param_str(params),
- )
+ );
}
}
}
diff --git a/src/term.rs b/src/term.rs
index 31e1f51..4719d41 100644
--- a/src/term.rs
+++ b/src/term.rs
@@ -26,9 +26,9 @@ impl BufWrite for ClearRowForward {
#[derive(Default, Debug)]
#[must_use = "this struct does nothing unless you call write_buf"]
-pub struct CRLF;
+pub struct Crlf;
-impl BufWrite for CRLF {
+impl BufWrite for Crlf {
fn write_buf(&self, buf: &mut Vec<u8>) {
buf.extend_from_slice(b"\r\n");
}
@@ -100,7 +100,7 @@ pub struct ClearAttrs;
impl BufWrite for ClearAttrs {
fn write_buf(&self, buf: &mut Vec<u8>) {
- buf.extend_from_slice(b"\x1b[m")
+ buf.extend_from_slice(b"\x1b[m");
}
}
@@ -149,6 +149,7 @@ impl Attrs {
impl BufWrite for Attrs {
#[allow(unused_assignments)]
+ #[allow(clippy::branches_sharing_code)]
fn write_buf(&self, buf: &mut Vec<u8>) {
if self.fgcolor.is_none()
&& self.bgcolor.is_none()
@@ -341,9 +342,9 @@ impl HideCursor {
impl BufWrite for HideCursor {
fn write_buf(&self, buf: &mut Vec<u8>) {
if self.state {
- buf.extend_from_slice(b"\x1b[?25l")
+ buf.extend_from_slice(b"\x1b[?25l");
} else {
- buf.extend_from_slice(b"\x1b[?25h")
+ buf.extend_from_slice(b"\x1b[?25h");
}
}
}
@@ -364,7 +365,7 @@ impl MoveFromTo {
impl BufWrite for MoveFromTo {
fn write_buf(&self, buf: &mut Vec<u8>) {
if self.to.row == self.from.row + 1 && self.to.col == 0 {
- crate::term::CRLF::default().write_buf(buf);
+ crate::term::Crlf::default().write_buf(buf);
} else if self.from.row == self.to.row && self.from.col < self.to.col
{
crate::term::MoveRight::new(self.to.col - self.from.col)
@@ -458,9 +459,9 @@ impl ApplicationKeypad {
impl BufWrite for ApplicationKeypad {
fn write_buf(&self, buf: &mut Vec<u8>) {
if self.state {
- buf.extend_from_slice(b"\x1b=")
+ buf.extend_from_slice(b"\x1b=");
} else {
- buf.extend_from_slice(b"\x1b>")
+ buf.extend_from_slice(b"\x1b>");
}
}
}
@@ -480,9 +481,9 @@ impl ApplicationCursor {
impl BufWrite for ApplicationCursor {
fn write_buf(&self, buf: &mut Vec<u8>) {
if self.state {
- buf.extend_from_slice(b"\x1b[?1h")
+ buf.extend_from_slice(b"\x1b[?1h");
} else {
- buf.extend_from_slice(b"\x1b[?1l")
+ buf.extend_from_slice(b"\x1b[?1l");
}
}
}
@@ -502,9 +503,9 @@ impl BracketedPaste {
impl BufWrite for BracketedPaste {
fn write_buf(&self, buf: &mut Vec<u8>) {
if self.state {
- buf.extend_from_slice(b"\x1b[?2004h")
+ buf.extend_from_slice(b"\x1b[?2004h");
} else {
- buf.extend_from_slice(b"\x1b[?2004l")
+ buf.extend_from_slice(b"\x1b[?2004l");
}
}
}