Allow Clone of layout structs #170
Annotations
15 warnings
docs for function returning `Result` missing `# Errors` section:
src/edit/vi.rs#L975
warning: docs for function returning `Result` missing `# Errors` section
--> src/edit/vi.rs:975:5
|
975 | / pub fn load_text<P: AsRef<std::path::Path>>(
976 | | &mut self,
977 | | path: P,
978 | | attrs: crate::Attrs,
979 | | ) -> 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#L628
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/edit/vi.rs:628:33
|
628 | / ... match text[..cursor.index]
629 | | ... .char_indices()
630 | | ... .filter_map(|(i, c)| {
631 | | ... if c == find_c {
... |
645 | | ... None => {}
646 | | ... }
| |_______________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
help: try
|
628 ~ if let Some(i) = text[..cursor.index]
629 + .char_indices()
630 + .filter_map(|(i, c)| {
631 + if c == find_c {
632 + let end = i + c.len_utf8();
633 + if end < cursor.index {
634 + return Some(end);
635 + }
636 + }
637 + None
638 + })
639 + .last() {
640 + cursor.index = i;
641 + editor.set_cursor(cursor);
642 + }
|
|
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`:
src/edit/vi.rs#L609
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/edit/vi.rs:609:33
|
609 | / ... match text[..cursor.index]
610 | | ... .char_indices()
611 | | ... .filter(|&(_, c)| c == find_c)
612 | | ... .last()
... |
618 | | ... None => {}
619 | | ... }
| |_______________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
help: try
|
609 ~ if let Some((i, _)) = text[..cursor.index]
610 + .char_indices()
611 + .filter(|&(_, c)| c == find_c)
612 + .last() {
613 + cursor.index = i;
614 + editor.set_cursor(cursor);
615 + }
|
|
called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead:
src/edit/vi.rs#L511
warning: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
--> src/edit/vi.rs:511:39
|
511 | ... match text[cursor.index..]
| _____________________________^
512 | | ... .char_indices()
513 | | ... .filter(|&(i, c)| i > 0 && c == find_c)
514 | | ... .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
|
511 ~ match text[cursor.index..]
512 + .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#L511
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/edit/vi.rs:511:33
|
511 | / ... match text[cursor.index..]
512 | | ... .char_indices()
513 | | ... .filter(|&(i, c)| i > 0 && c == find_c)
514 | | ... .next()
... |
520 | | ... None => {}
521 | | ... }
| |_______________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
help: try
|
511 ~ if let Some((i, _)) = text[cursor.index..]
512 + .char_indices()
513 + .filter(|&(i, c)| i > 0 && c == find_c)
514 + .next() {
515 + cursor.index += i;
516 + editor.set_cursor(cursor);
517 + }
|
|
match expression looks like `matches!` macro:
src/edit/vi.rs#L360
warning: match expression looks like `matches!` macro
--> src/edit/vi.rs:360:29
|
360 | let has_selection = match editor.selection() {
| _____________________________^
361 | | Selection::None => false,
362 | | _ => true,
363 | | };
| |_________^ 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#L182
warning: docs for function returning `Result` missing `# Errors` section
--> src/edit/vi.rs:182:5
|
182 | / pub fn load_text<P: AsRef<std::path::Path>>(
183 | | &mut self,
184 | | font_system: &mut FontSystem,
185 | | path: P,
186 | | attrs: crate::Attrs,
187 | | ) -> 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#L345
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/edit/editor.rs:345:9
|
345 | / match self.change.take() {
346 | | Some(pending) => {
347 | | if !pending.items.is_empty() {
348 | | //TODO: is this a good idea?
... |
354 | | None => {}
355 | | }
| |_________^
|
= 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
|
345 ~ if let Some(pending) = self.change.take() {
346 + if !pending.items.is_empty() {
347 + //TODO: is this a good idea?
348 + log::warn!("pending change caused apply_change to be ignored!");
349 + self.change = Some(pending);
350 + return false;
351 + }
352 + }
|
|
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)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|