Skip to content

Editor: set selection to none when deleted #470

Editor: set selection to none when deleted

Editor: set selection to none when deleted #470

Triggered via push November 30, 2023 21:42
Status Failure
Total duration 2m 40s
Artifacts

rust.yml

on: push
Fit to window
Zoom out
Zoom in

Annotations

18 warnings
docs for function returning `Result` missing `# Errors` section: src/edit/vi.rs#L985
warning: docs for function returning `Result` missing `# Errors` section --> src/edit/vi.rs:985:5 | 985 | / pub fn load_text<P: AsRef<std::path::Path>>( 986 | | &mut self, 987 | | path: P, 988 | | attrs: crate::Attrs, 989 | | ) -> 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#L638
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> src/edit/vi.rs:638:33 | 638 | / ... match text[..cursor.index] 639 | | ... .char_indices() 640 | | ... .filter_map(|(i, c)| { 641 | | ... if c == find_c { ... | 655 | | ... None => {} 656 | | ... } | |_______________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match help: try | 638 ~ if let Some(i) = text[..cursor.index] 639 + .char_indices() 640 + .filter_map(|(i, c)| { 641 + if c == find_c { 642 + let end = i + c.len_utf8(); 643 + if end < cursor.index { 644 + return Some(end); 645 + } 646 + } 647 + None 648 + }) 649 + .last() { 650 + cursor.index = i; 651 + editor.set_cursor(cursor); 652 + } |
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`: src/edit/vi.rs#L619
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> src/edit/vi.rs:619:33 | 619 | / ... match text[..cursor.index] 620 | | ... .char_indices() 621 | | ... .filter(|&(_, c)| c == find_c) 622 | | ... .last() ... | 628 | | ... None => {} 629 | | ... } | |_______________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match help: try | 619 ~ if let Some((i, _)) = text[..cursor.index] 620 + .char_indices() 621 + .filter(|&(_, c)| c == find_c) 622 + .last() { 623 + cursor.index = i; 624 + editor.set_cursor(cursor); 625 + } |
called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead: src/edit/vi.rs#L521
warning: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead --> src/edit/vi.rs:521:39 | 521 | ... match text[cursor.index..] | _____________________________^ 522 | | ... .char_indices() 523 | | ... .filter(|&(i, c)| i > 0 && c == find_c) 524 | | ... .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 | 521 ~ match text[cursor.index..] 522 + .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#L521
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> src/edit/vi.rs:521:33 | 521 | / ... match text[cursor.index..] 522 | | ... .char_indices() 523 | | ... .filter(|&(i, c)| i > 0 && c == find_c) 524 | | ... .next() ... | 530 | | ... None => {} 531 | | ... } | |_______________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match help: try | 521 ~ if let Some((i, _)) = text[cursor.index..] 522 + .char_indices() 523 + .filter(|&(i, c)| i > 0 && c == find_c) 524 + .next() { 525 + cursor.index += i; 526 + editor.set_cursor(cursor); 527 + } |
match expression looks like `matches!` macro: src/edit/vi.rs#L362
warning: match expression looks like `matches!` macro --> src/edit/vi.rs:362:29 | 362 | let has_selection = match editor.selection() { | _____________________________^ 363 | | Selection::None => false, 364 | | _ => true, 365 | | }; | |_________^ 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#L184
warning: docs for function returning `Result` missing `# Errors` section --> src/edit/vi.rs:184:5 | 184 | / pub fn load_text<P: AsRef<std::path::Path>>( 185 | | &mut self, 186 | | font_system: &mut FontSystem, 187 | | path: P, 188 | | attrs: crate::Attrs, 189 | | ) -> 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/vi.rs#L33
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> src/edit/vi.rs:33:5 | 33 | / match editor.finish_change() { 34 | | Some(change) => { 35 | | if !change.items.is_empty() { 36 | | commands.push(change); ... | 40 | | None => {} 41 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match help: try | 33 ~ if let Some(change) = editor.finish_change() { 34 + if !change.items.is_empty() { 35 + commands.push(change); 36 + *changed = true; 37 + } 38 + } |
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`: src/edit/editor.rs#L348
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> src/edit/editor.rs:348:9 | 348 | / match self.change.take() { 349 | | Some(pending) => { 350 | | if !pending.items.is_empty() { 351 | | //TODO: is this a good idea? ... | 357 | | None => {} 358 | | } | |_________^ | = 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 | 348 ~ if let Some(pending) = self.change.take() { 349 + if !pending.items.is_empty() { 350 + //TODO: is this a good idea? 351 + log::warn!("pending change caused apply_change to be ignored!"); 352 + self.change = Some(pending); 353 + return false; 354 + } 355 + } |
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)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^
unused variable: `selection`: src/edit/vi.rs#L388
warning: unused variable: `selection` --> src/edit/vi.rs:388:34 | 388 | if let Some((selection, data)) = self.registers.get(&register) { | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_selection`
unused variable: `after`: src/edit/vi.rs#L387
warning: unused variable: `after` --> src/edit/vi.rs:387:40 | 387 | Event::Put { register, after } => { | ^^^^^ help: try ignoring the field: `after: _` | = note: `#[warn(unused_variables)]` 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/