Refactor #484
rust.yml
on: pull_request
cargo-deny
41s
build
2m 45s
Annotations
19 warnings
item in documentation is missing backticks:
src/edit/mod.rs#L249
warning: item in documentation is missing backticks
--> src/edit/mod.rs:249:56
|
249 | /// Insert text at specified cursor with specified attrs_list
| ^^^^^^^^^^
|
= 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
|
249 | /// Insert text at specified cursor with specified `attrs_list`
| ~~~~~~~~~~~~
|
consider adding a `;` to the last statement for consistent formatting:
src/edit/mod.rs#L146
warning: consider adding a `;` to the last statement for consistent formatting
--> src/edit/mod.rs:146:9
|
146 | self.with_buffer_mut(|buffer| buffer.set_redraw(redraw))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `self.with_buffer_mut(|buffer| buffer.set_redraw(redraw));`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
|
docs for function returning `Result` missing `# Errors` section:
src/edit/vi.rs#L1104
warning: docs for function returning `Result` missing `# Errors` section
--> src/edit/vi.rs:1104:5
|
1104 | / pub fn load_text<P: AsRef<std::path::Path>>(
1105 | | &mut self,
1106 | | path: P,
1107 | | attrs: crate::Attrs,
1108 | | ) -> std::io::Result<()> {
| |____________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
|
manual implementation of `Option::map`:
src/edit/vi.rs#L1071
warning: manual implementation of `Option::map`
--> src/edit/vi.rs:1071:37
|
1071 | / ... if let Some(last) = layout_runs.last() {
1072 | | ... Some(Action::Motion(Motion::GotoLine(
1073 | | ... (last.line_i + first.line_i) / 2,
1074 | | ... )))
1075 | | ... } else {
1076 | | ... None
1077 | | ... }
| |_______________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
= note: `#[warn(clippy::manual_map)]` on by default
help: try
|
1071 ~ layout_runs.last().map(|last| Action::Motion(Motion::GotoLine(
1072 + (last.line_i + first.line_i) / 2,
1073 + )))
|
|
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`:
src/edit/vi.rs#L944
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/edit/vi.rs:944:37
|
944 | / ... match text[..cursor.index]
945 | | ... .char_indices()
946 | | ... .filter_map(|(i, c)| {
947 | | ... if c == find_c {
... |
960 | | ... None => {}
961 | | ... }
| |_______________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
help: try
|
944 ~ if let Some(i) = text[..cursor.index]
945 + .char_indices()
946 + .filter_map(|(i, c)| {
947 + if c == find_c {
948 + let end = i + c.len_utf8();
949 + if end < cursor.index {
950 + return Some(end);
951 + }
952 + }
953 + None
954 + })
955 + .last() {
956 + cursor.index = i;
957 + }
|
|
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`:
src/edit/vi.rs#L924
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/edit/vi.rs:924:37
|
924 | / ... match text[..cursor.index]
925 | | ... .char_indices()
926 | | ... .filter(|&(_, c)| c == find_c)
927 | | ... .last()
... |
932 | | ... None => {}
933 | | ... }
| |_______________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
help: try
|
924 ~ if let Some((i, _)) = text[..cursor.index]
925 + .char_indices()
926 + .filter(|&(_, c)| c == find_c)
927 + .last() {
928 + cursor.index = i;
929 + }
|
|
called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead:
src/edit/vi.rs#L818
warning: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
--> src/edit/vi.rs:818:43
|
818 | ... match text[cursor.index..]
| _____________________________^
819 | | ... .char_indices()
820 | | ... .filter(|&(i, c)| i > 0 && c == find_c)
821 | | ... .next()
| |_________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#filter_next
= note: `#[warn(clippy::filter_next)]` on by default
help: try
|
818 ~ match text[cursor.index..]
819 + .char_indices().find(|&(i, c)| i > 0 && c == find_c)
|
|
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`:
src/edit/vi.rs#L818
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/edit/vi.rs:818:37
|
818 | / ... match text[cursor.index..]
819 | | ... .char_indices()
820 | | ... .filter(|&(i, c)| i > 0 && c == find_c)
821 | | ... .next()
... |
826 | | ... None => {}
827 | | ... }
| |_______________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
help: try
|
818 ~ if let Some((i, _)) = text[cursor.index..]
819 + .char_indices()
820 + .filter(|&(i, c)| i > 0 && c == find_c)
821 + .next() {
822 + cursor.index += i;
823 + }
|
|
match expression looks like `matches!` macro:
src/edit/vi.rs#L594
warning: match expression looks like `matches!` macro
--> src/edit/vi.rs:594:29
|
594 | let has_selection = match editor.selection() {
| _____________________________^
595 | | Selection::None => false,
596 | | _ => true,
597 | | };
| |_________^ help: try: `!matches!(editor.selection(), Selection::None)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro
= note: `#[warn(clippy::match_like_matches_macro)]` on by default
|
docs for function returning `Result` missing `# Errors` section:
src/edit/vi.rs#L189
warning: docs for function returning `Result` missing `# Errors` section
--> src/edit/vi.rs:189:5
|
189 | / pub fn load_text<P: AsRef<std::path::Path>>(
190 | | &mut self,
191 | | font_system: &mut FontSystem,
192 | | path: P,
193 | | attrs: crate::Attrs,
194 | | ) -> 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)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
consider adding a `;` to the last statement for consistent formatting:
src/edit/syntect.rs#L128
warning: consider adding a `;` to the last statement for consistent formatting
--> src/edit/syntect.rs:128:13
|
128 | buffer.set_text(font_system, &text, attrs, Shaping::Advanced)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `buffer.set_text(font_system, &text, attrs, Shaping::Advanced);`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
note: the lint level is defined here
--> src/lib.rs:90:9
|
90 | #![warn(clippy::semicolon_if_nothing_returned)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`:
src/edit/editor.rs#L527
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/edit/editor.rs:527:9
|
527 | / match self.change.take() {
528 | | Some(pending) => {
529 | | if !pending.items.is_empty() {
530 | | //TODO: is this a good idea?
... |
536 | | None => {}
537 | | }
| |_________^
|
= 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
|
527 ~ if let Some(pending) = self.change.take() {
528 + if !pending.items.is_empty() {
529 + //TODO: is this a good idea?
530 + log::warn!("pending change caused apply_change to be ignored!");
531 + self.change = Some(pending);
532 + return false;
533 + }
534 + }
|
|
docs for function which may panic missing `# Panics` section:
src/buffer_line.rs#L198
warning: docs for function which may panic missing `# Panics` section
--> src/buffer_line.rs:198:5
|
198 | / pub fn layout_in_buffer(
199 | | &mut self,
200 | | scratch: &mut ShapeBuffer,
201 | | font_system: &mut FontSystem,
... |
204 | | wrap: Wrap,
205 | | ) -> &[LayoutLine] {
| |______________________^
|
note: first possible panic found here
--> src/buffer_line.rs:213:9
|
213 | 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#L157
warning: docs for function which may panic missing `# Panics` section
--> src/buffer_line.rs:157:5
|
157 | / pub fn shape_in_buffer(
158 | | &mut self,
159 | | scratch: &mut ShapeBuffer,
160 | | font_system: &mut FontSystem,
161 | | ) -> &ShapeLine {
| |___________________^
|
note: first possible panic found here
--> src/buffer_line.rs:172:9
|
172 | 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#L360
warning: docs for function which may panic missing `# Panics` section
--> src/buffer.rs:360:5
|
360 | pub fn shape_until_scroll(&mut self, font_system: &mut FontSystem, prune: bool) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first possible panic found here
--> src/buffer.rs:398:30
|
398 | let layout = self
| ______________________________^
399 | | .line_layout(font_system, line_i)
400 | | .expect("shape_until_scroll invalid line");
| |______________________________________________________________^
= 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#L312
warning: docs for function which may panic missing `# Panics` section
--> src/buffer.rs:312:5
|
312 | / pub fn shape_until_cursor(
313 | | &mut self,
314 | | font_system: &mut FontSystem,
315 | | cursor: Cursor,
316 | | prune: bool,
317 | | ) {
| |_____^
|
note: first possible panic found here
--> src/buffer.rs:320:29
|
320 | let layout_cursor = self
| _____________________________^
321 | | .layout_cursor(font_system, cursor)
322 | | .expect("shape_until_cursor invalid cursor");
| |________________________________________________________^
= 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#L38
warning: docs for function which may panic missing `# Panics` section
--> src/buffer.rs:38:5
|
38 | pub fn highlight(&self, cursor_start: Cursor, cursor_end: Cursor) -> Option<(f32, f32)> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first possible panic found here
--> src/buffer.rs:60:25
|
60 | 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
|
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)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
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/
|