Refactor #480
rust.yml
on: pull_request
cargo-deny
38s
build
2m 45s
Annotations
16 warnings
item in documentation is missing backticks:
src/edit/mod.rs#L239
warning: item in documentation is missing backticks
--> src/edit/mod.rs:239:56
|
239 | /// 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
|
239 | /// Insert text at specified cursor with specified `attrs_list`
| ~~~~~~~~~~~~
|
docs for function returning `Result` missing `# Errors` section:
src/edit/vi.rs#L1054
warning: docs for function returning `Result` missing `# Errors` section
--> src/edit/vi.rs:1054:5
|
1054 | / pub fn load_text<P: AsRef<std::path::Path>>(
1055 | | &mut self,
1056 | | path: P,
1057 | | attrs: crate::Attrs,
1058 | | ) -> std::io::Result<()> {
| |____________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
|
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`:
src/edit/vi.rs#L705
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/edit/vi.rs:705:33
|
705 | / ... match text[..cursor.index]
706 | | ... .char_indices()
707 | | ... .filter_map(|(i, c)| {
708 | | ... if c == find_c {
... |
722 | | ... None => {}
723 | | ... }
| |_______________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
help: try
|
705 ~ if let Some(i) = text[..cursor.index]
706 + .char_indices()
707 + .filter_map(|(i, c)| {
708 + if c == find_c {
709 + let end = i + c.len_utf8();
710 + if end < cursor.index {
711 + return Some(end);
712 + }
713 + }
714 + None
715 + })
716 + .last() {
717 + cursor.index = i;
718 + editor.set_cursor(cursor);
719 + }
|
|
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`:
src/edit/vi.rs#L686
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/edit/vi.rs:686:33
|
686 | / ... match text[..cursor.index]
687 | | ... .char_indices()
688 | | ... .filter(|&(_, c)| c == find_c)
689 | | ... .last()
... |
695 | | ... None => {}
696 | | ... }
| |_______________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
help: try
|
686 ~ if let Some((i, _)) = text[..cursor.index]
687 + .char_indices()
688 + .filter(|&(_, c)| c == find_c)
689 + .last() {
690 + cursor.index = i;
691 + editor.set_cursor(cursor);
692 + }
|
|
called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead:
src/edit/vi.rs#L588
warning: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
--> src/edit/vi.rs:588:39
|
588 | ... match text[cursor.index..]
| _____________________________^
589 | | ... .char_indices()
590 | | ... .filter(|&(i, c)| i > 0 && c == find_c)
591 | | ... .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
|
588 ~ match text[cursor.index..]
589 + .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#L588
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/edit/vi.rs:588:33
|
588 | / ... match text[cursor.index..]
589 | | ... .char_indices()
590 | | ... .filter(|&(i, c)| i > 0 && c == find_c)
591 | | ... .next()
... |
597 | | ... None => {}
598 | | ... }
| |_______________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
help: try
|
588 ~ if let Some((i, _)) = text[cursor.index..]
589 + .char_indices()
590 + .filter(|&(i, c)| i > 0 && c == find_c)
591 + .next() {
592 + cursor.index += i;
593 + editor.set_cursor(cursor);
594 + }
|
|
match expression looks like `matches!` macro:
src/edit/vi.rs#L367
warning: match expression looks like `matches!` macro
--> src/edit/vi.rs:367:29
|
367 | let has_selection = match editor.selection() {
| _____________________________^
368 | | Selection::None => false,
369 | | _ => true,
370 | | };
| |_________^ 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#L185
warning: docs for function returning `Result` missing `# Errors` section
--> src/edit/vi.rs:185:5
|
185 | / pub fn load_text<P: AsRef<std::path::Path>>(
186 | | &mut self,
187 | | font_system: &mut FontSystem,
188 | | path: P,
189 | | attrs: crate::Attrs,
190 | | ) -> 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#L306
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/edit/editor.rs:306:9
|
306 | / match self.change.take() {
307 | | Some(pending) => {
308 | | if !pending.items.is_empty() {
309 | | //TODO: is this a good idea?
... |
315 | | None => {}
316 | | }
| |_________^
|
= 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
|
306 ~ if let Some(pending) = self.change.take() {
307 + if !pending.items.is_empty() {
308 + //TODO: is this a good idea?
309 + log::warn!("pending change caused apply_change to be ignored!");
310 + self.change = Some(pending);
311 + return false;
312 + }
313 + }
|
|
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:368:34
|
368 | let layout = self
| __________________________________^
369 | | .line_layout(font_system, self.scroll.line)
370 | | .expect("shape_until_scroll invalid scroll.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/
|