Vi editor improvements #451
rust.yml
on: pull_request
cargo-deny
42s
build
2m 54s
Annotations
20 warnings
item in documentation is missing backticks:
src/edit/mod.rs#L131
warning: item in documentation is missing backticks
--> src/edit/mod.rs:131:38
|
131 | /// Set the current tab width. A tab_width of 0 is not allowed, and will be ignored
| ^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
note: the lint level is defined here
--> src/lib.rs:84:9
|
84 | #![warn(clippy::doc_markdown)]
| ^^^^^^^^^^^^^^^^^^^^
help: try
|
131 | /// Set the current tab width. A `tab_width` of 0 is not allowed, and will be ignored
| ~~~~~~~~~~~
|
docs for function returning `Result` missing `# Errors` section:
src/edit/vi.rs#L638
warning: docs for function returning `Result` missing `# Errors` section
--> src/edit/vi.rs:638:5
|
638 | / pub fn load_text<P: AsRef<std::path::Path>>(
639 | | &mut self,
640 | | path: P,
641 | | attrs: crate::Attrs,
642 | | ) -> std::io::Result<()> {
| |____________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
|
this match could be replaced by its body itself:
src/edit/vi.rs#L368
warning: this match could be replaced by its body itself
--> src/edit/vi.rs:368:38
|
368 | Action::Insert(c) => match c {
| ______________________________________^
369 | | _ => {
370 | | value.push(c);
371 | | }
372 | | },
| |_________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_single_binding
= note: `#[warn(clippy::match_single_binding)]` on by default
help: consider using the match body instead
|
368 ~ Action::Insert(c) => {
369 + value.push(c);
370 ~ },
|
|
docs for function returning `Result` missing `# Errors` section:
src/edit/vi.rs#L42
warning: docs for function returning `Result` missing `# Errors` section
--> src/edit/vi.rs:42:5
|
42 | / pub fn load_text<P: AsRef<std::path::Path>>(
43 | | &mut self,
44 | | font_system: &mut FontSystem,
45 | | path: P,
46 | | attrs: crate::Attrs,
47 | | ) -> std::io::Result<()> {
| |____________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
note: the lint level is defined here
--> src/lib.rs:86:9
|
86 | #![warn(clippy::missing_errors_doc)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`:
src/edit/editor.rs#L737
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/edit/editor.rs:737:21
|
737 | / match self.select_opt {
738 | | Some(ref mut select) => {
739 | | if select.line == line_i {
740 | | if select.index > last_indent {
... |
745 | | None => {}
746 | | }
| |_____________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
help: try
|
737 ~ if let Some(ref mut select) = self.select_opt {
738 + if select.line == line_i {
739 + if select.index > last_indent {
740 + select.index -= after_whitespace - last_indent;
741 + }
742 + }
743 + }
|
|
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`:
src/edit/editor.rs#L660
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/edit/editor.rs:660:21
|
660 | / match self.select_opt {
661 | | Some(ref mut select) => {
662 | | if select.line == line_i {
663 | | if select.index >= after_whitespace {
... |
668 | | None => {}
669 | | }
| |_____________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
= note: `#[warn(clippy::single_match)]` on by default
help: try
|
660 ~ if let Some(ref mut select) = self.select_opt {
661 + if select.line == line_i {
662 + if select.index >= after_whitespace {
663 + select.index += required_indent;
664 + }
665 + }
666 + }
|
|
docs for function which may panic missing `# Panics` section:
src/buffer_line.rs#L218
warning: docs for function which may panic missing `# Panics` section
--> src/buffer_line.rs:218:5
|
218 | / pub fn layout_in_buffer(
219 | | &mut self,
220 | | scratch: &mut ShapeBuffer,
221 | | font_system: &mut FontSystem,
... |
224 | | wrap: Wrap,
225 | | ) -> &[LayoutLine] {
| |______________________^
|
note: first possible panic found here
--> src/buffer_line.rs:234:9
|
234 | self.layout_opt.as_ref().expect("layout not found")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
|
docs for function which may panic missing `# Panics` section:
src/buffer_line.rs#L200
warning: docs for function which may panic missing `# Panics` section
--> src/buffer_line.rs:200:5
|
200 | / pub fn layout(
201 | | &mut self,
202 | | font_system: &mut FontSystem,
203 | | font_size: f32,
204 | | width: f32,
205 | | wrap: Wrap,
206 | | ) -> &[LayoutLine] {
| |______________________^
|
note: first possible panic found here
--> src/buffer_line.rs:214:9
|
214 | self.layout_opt.as_ref().expect("layout not found")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
|
docs for function which may panic missing `# Panics` section:
src/buffer_line.rs#L176
warning: docs for function which may panic missing `# Panics` section
--> src/buffer_line.rs:176:5
|
176 | / pub fn shape_in_buffer(
177 | | &mut self,
178 | | scratch: &mut ShapeBuffer,
179 | | font_system: &mut FontSystem,
180 | | ) -> &ShapeLine {
| |___________________^
|
note: first possible panic found here
--> src/buffer_line.rs:191:9
|
191 | self.shape_opt.as_ref().expect("shape not found")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
|
docs for function which may panic missing `# Panics` section:
src/buffer.rs#L494
warning: docs for function which may panic missing `# Panics` section
--> src/buffer.rs:494:5
|
494 | pub fn layout_cursor(&self, cursor: &Cursor) -> LayoutCursor {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first possible panic found here
--> src/buffer.rs:498:22
|
498 | let layout = line.layout_opt().as_ref().expect("layout not found");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
|
docs for function which may panic missing `# Panics` section:
src/buffer.rs#L137
warning: docs for function which may panic missing `# Panics` section
--> src/buffer.rs:137:5
|
137 | pub fn highlight(&self, cursor_start: Cursor, cursor_end: Cursor) -> Option<(f32, f32)> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first possible panic found here
--> src/buffer.rs:159:25
|
159 | let x_end = x_end.expect("end of cursor not found");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
|
this `impl` can be derived:
src/buffer.rs#L89
warning: this `impl` can be derived
--> src/buffer.rs:89:1
|
89 | / impl Default for Affinity {
90 | | fn default() -> Self {
91 | | Affinity::Before
92 | | }
93 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
= note: `#[warn(clippy::derivable_impls)]` on by default
= help: remove the manual implementation...
help: ...and instead derive it...
|
58 + #[derive(Default)]
59 | pub enum Affinity {
|
help: ...and mark the default variant
|
59 ~ #[default]
60 ~ Before,
|
|
docs for function which may panic missing `# Panics` section:
src/attrs.rs#L272
warning: docs for function which may panic missing `# Panics` section
--> src/attrs.rs:272:5
|
272 | pub fn split_off(&mut self, index: usize) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first possible panic found here
--> src/attrs.rs:288:34
|
288 | let (range, attrs) = self
| __________________________________^
289 | | .spans
290 | | .get_key_value(&key.start)
291 | | .map(|v| (v.0.clone(), v.1.clone()))
292 | | .expect("attrs span not found");
| |_______________________________________________^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
note: the lint level is defined here
--> src/lib.rs:88:9
|
88 | #![warn(clippy::missing_panics_doc)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
this `else { if .. }` block can be collapsed:
src/shape.rs#L1254
warning: this `else { if .. }` block can be collapsed
--> src/shape.rs:1254:24
|
1254 | } else {
| ________________________^
1255 | | if self.rtl {
1256 | | start_x - x
1257 | | } else {
1258 | | x
1259 | | }
1260 | | },
| |_________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
= note: `#[warn(clippy::collapsible_else_if)]` on by default
help: collapse nested if block
|
1254 ~ } else if self.rtl {
1255 + start_x - x
1256 + } else {
1257 + x
1258 ~ },
|
|
this `if` statement can be collapsed:
src/edit/editor.rs#L739
warning: this `if` statement can be collapsed
--> src/edit/editor.rs:739:29
|
739 | / ... if select.line == line_i {
740 | | ... if select.index > last_indent {
741 | | ... select.index -= after_whitespace - last_indent;
742 | | ... }
743 | | ... }
| |_______________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
help: collapse nested if block
|
739 ~ if select.line == line_i && select.index > last_indent {
740 + select.index -= after_whitespace - last_indent;
741 + }
|
|
this `if` statement can be collapsed:
src/edit/editor.rs#L729
warning: this `if` statement can be collapsed
--> src/edit/editor.rs:729:21
|
729 | / if self.cursor.line == line_i {
730 | | if self.cursor.index > last_indent {
731 | | self.cursor.index -= after_whitespace - last_indent;
732 | | self.cursor_moved = true;
733 | | }
734 | | }
| |_____________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
help: collapse nested if block
|
729 ~ if self.cursor.line == line_i && self.cursor.index > last_indent {
730 + self.cursor.index -= after_whitespace - last_indent;
731 + self.cursor_moved = true;
732 + }
|
|
this `if` statement can be collapsed:
src/edit/editor.rs#L662
warning: this `if` statement can be collapsed
--> src/edit/editor.rs:662:29
|
662 | / ... if select.line == line_i {
663 | | ... if select.index >= after_whitespace {
664 | | ... select.index += required_indent;
665 | | ... }
666 | | ... }
| |_______________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
help: collapse nested if block
|
662 ~ if select.line == line_i && select.index >= after_whitespace {
663 + select.index += required_indent;
664 + }
|
|
this `if` statement can be collapsed:
src/edit/editor.rs#L652
warning: this `if` statement can be collapsed
--> src/edit/editor.rs:652:21
|
652 | / if self.cursor.line == line_i {
653 | | if self.cursor.index >= after_whitespace {
654 | | self.cursor.index += required_indent;
655 | | self.cursor_moved = true;
656 | | }
657 | | }
| |_____________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
= note: `#[warn(clippy::collapsible_if)]` on by default
help: collapse nested if block
|
652 ~ if self.cursor.line == line_i && self.cursor.index >= after_whitespace {
653 + self.cursor.index += required_indent;
654 + self.cursor_moved = true;
655 + }
|
|
lint `clippy::integer_arithmetic` has been renamed to `clippy::arithmetic_side_effects`:
src/lib.rs#L67
warning: lint `clippy::integer_arithmetic` has been renamed to `clippy::arithmetic_side_effects`
--> src/lib.rs:67:10
|
67 | #![allow(clippy::integer_arithmetic)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::arithmetic_side_effects`
|
= note: `#[warn(renamed_and_removed_lints)]` on by default
|
build
The following actions uses node12 which is deprecated and will be forced to run on node16: actions-rs/clippy-check@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
|