Skip to content

Use crate::HashMap in SwashCache #487

Use crate::HashMap in SwashCache

Use crate::HashMap in SwashCache #487

Triggered via push December 20, 2023 00:02
Status Failure
Total duration 2m 45s
Artifacts

rust.yml

on: push
Fit to window
Zoom out
Zoom in

Annotations

16 warnings
item in documentation is missing backticks: src/edit/mod.rs#L279
warning: item in documentation is missing backticks --> src/edit/mod.rs:279:56 | 279 | /// 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 | 279 | /// Insert text at specified cursor with specified `attrs_list` | ~~~~~~~~~~~~
docs for function returning `Result` missing `# Errors` section: src/edit/vi.rs#L1050
warning: docs for function returning `Result` missing `# Errors` section --> src/edit/vi.rs:1050:5 | 1050 | / pub fn load_text<P: AsRef<std::path::Path>>( 1051 | | &mut self, 1052 | | path: P, 1053 | | attrs: crate::Attrs, 1054 | | ) -> 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#L703
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> src/edit/vi.rs:703:33 | 703 | / ... match text[..cursor.index] 704 | | ... .char_indices() 705 | | ... .filter_map(|(i, c)| { 706 | | ... if c == find_c { ... | 720 | | ... None => {} 721 | | ... } | |_______________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match help: try | 703 ~ if let Some(i) = text[..cursor.index] 704 + .char_indices() 705 + .filter_map(|(i, c)| { 706 + if c == find_c { 707 + let end = i + c.len_utf8(); 708 + if end < cursor.index { 709 + return Some(end); 710 + } 711 + } 712 + None 713 + }) 714 + .last() { 715 + cursor.index = i; 716 + editor.set_cursor(cursor); 717 + } |
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`: src/edit/vi.rs#L684
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> src/edit/vi.rs:684:33 | 684 | / ... match text[..cursor.index] 685 | | ... .char_indices() 686 | | ... .filter(|&(_, c)| c == find_c) 687 | | ... .last() ... | 693 | | ... None => {} 694 | | ... } | |_______________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match help: try | 684 ~ if let Some((i, _)) = text[..cursor.index] 685 + .char_indices() 686 + .filter(|&(_, c)| c == find_c) 687 + .last() { 688 + cursor.index = i; 689 + editor.set_cursor(cursor); 690 + } |
called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead: src/edit/vi.rs#L586
warning: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead --> src/edit/vi.rs:586:39 | 586 | ... match text[cursor.index..] | _____________________________^ 587 | | ... .char_indices() 588 | | ... .filter(|&(i, c)| i > 0 && c == find_c) 589 | | ... .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 | 586 ~ match text[cursor.index..] 587 + .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#L586
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> src/edit/vi.rs:586:33 | 586 | / ... match text[cursor.index..] 587 | | ... .char_indices() 588 | | ... .filter(|&(i, c)| i > 0 && c == find_c) 589 | | ... .next() ... | 595 | | ... None => {} 596 | | ... } | |_______________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match help: try | 586 ~ if let Some((i, _)) = text[cursor.index..] 587 + .char_indices() 588 + .filter(|&(i, c)| i > 0 && c == find_c) 589 + .next() { 590 + cursor.index += i; 591 + editor.set_cursor(cursor); 592 + } |
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#L342
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> src/edit/editor.rs:342:9 | 342 | / match self.change.take() { 343 | | Some(pending) => { 344 | | if !pending.items.is_empty() { 345 | | //TODO: is this a good idea? ... | 351 | | None => {} 352 | | } | |_________^ | = 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 | 342 ~ if let Some(pending) = self.change.take() { 343 + if !pending.items.is_empty() { 344 + //TODO: is this a good idea? 345 + log::warn!("pending change caused apply_change to be ignored!"); 346 + self.change = Some(pending); 347 + return false; 348 + } 349 + } |
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#L486
warning: docs for function which may panic missing `# Panics` section --> src/buffer.rs:486:5 | 486 | pub fn layout_cursor(&self, cursor: &Cursor) -> LayoutCursor { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first possible panic found here --> src/buffer.rs:490:22 | 490 | 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#L129
warning: docs for function which may panic missing `# Panics` section --> src/buffer.rs:129:5 | 129 | pub fn highlight(&self, cursor_start: Cursor, cursor_end: Cursor) -> Option<(f32, f32)> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first possible panic found here --> src/buffer.rs:151:25 | 151 | 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/