Add the possibility to change the orientation of Menu #8
rust-check.yml
on: pull_request
stable / fmt
9s
nightly / doc
18s
Matrix: clippy
Annotations
10 warnings
this `else { if .. }` block can be collapsed:
src/lib.rs#L353
warning: this `else { if .. }` block can be collapsed
--> src/lib.rs:353:20
|
353 | } else {
| ____________________^
354 | | if let Some(ref data) = item.data {
355 | | self.events.push(MenuEvent::Selected(data.clone()));
356 | | }
357 | | }
| |_____________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
= note: `#[warn(clippy::collapsible_else_if)]` on by default
help: collapse nested if block
|
353 ~ } else if let Some(ref data) = item.data {
354 + self.events.push(MenuEvent::Selected(data.clone()));
355 + }
|
|
redundant guard:
src/lib.rs#L169
warning: redundant guard
--> src/lib.rs:169:30
|
169 | Some(idx) if idx == 0 => {
| ^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_guards
= note: `#[warn(clippy::redundant_guards)]` on by default
help: try
|
169 - Some(idx) if idx == 0 => {
169 + Some(0) => {
|
|
called `.iter_mut().nth()` on a `Vec`:
src/lib.rs#L452
warning: called `.iter_mut().nth()` on a `Vec`
--> src/lib.rs:452:31
|
452 | if let Some(it) = self.children.iter_mut().nth(0) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_nth
= note: `#[warn(clippy::iter_nth)]` on by default
help: `get_mut` is equivalent but more concise
|
452 | if let Some(it) = self.children.get_mut(0) {
| ~~~~~~~
|
called `map(..).flatten()` on `Option`:
src/lib.rs#L559
warning: called `map(..).flatten()` on `Option`
--> src/lib.rs:559:14
|
559 | .map(|x| x.highlight_child_mut())
| ______________^
560 | | .flatten()
| |______________________^ help: try replacing `map` with `and_then` and remove the `.flatten()`: `and_then(|x| x.highlight_child_mut())`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten
= note: `#[warn(clippy::map_flatten)]` on by default
|
you should consider adding a `Default` implementation for `Menu<T>`:
src/lib.rs#L583
warning: you should consider adding a `Default` implementation for `Menu<T>`
--> src/lib.rs:583:5
|
583 | / pub fn new() -> Self {
584 | | Self {
585 | | highlight_item_style: Style::default().fg(Color::White).bg(Color::LightBlue),
586 | | default_item_style: Style::default().fg(Color::White),
... |
590 | | }
591 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
= note: `#[warn(clippy::new_without_default)]` on by default
help: try adding this
|
582 + impl<T> Default for Menu<T> {
583 + fn default() -> Self {
584 + Self::new()
585 + }
586 + }
|
|
this `else { if .. }` block can be collapsed:
src/lib.rs#L353
warning: this `else { if .. }` block can be collapsed
--> src/lib.rs:353:20
|
353 | } else {
| ____________________^
354 | | if let Some(ref data) = item.data {
355 | | self.events.push(MenuEvent::Selected(data.clone()));
356 | | }
357 | | }
| |_____________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
= note: `#[warn(clippy::collapsible_else_if)]` on by default
help: collapse nested if block
|
353 ~ } else if let Some(ref data) = item.data {
354 + self.events.push(MenuEvent::Selected(data.clone()));
355 + }
|
|
redundant guard:
src/lib.rs#L169
warning: redundant guard
--> src/lib.rs:169:30
|
169 | Some(idx) if idx == 0 => {
| ^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_guards
= note: `#[warn(clippy::redundant_guards)]` on by default
help: try
|
169 - Some(idx) if idx == 0 => {
169 + Some(0) => {
|
|
called `.iter_mut().nth()` on a `Vec`:
src/lib.rs#L452
warning: called `.iter_mut().nth()` on a `Vec`
--> src/lib.rs:452:31
|
452 | if let Some(it) = self.children.iter_mut().nth(0) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_nth
= note: `#[warn(clippy::iter_nth)]` on by default
help: `get_mut` is equivalent but more concise
|
452 | if let Some(it) = self.children.get_mut(0) {
| ~~~~~~~
|
called `map(..).flatten()` on `Option`:
src/lib.rs#L559
warning: called `map(..).flatten()` on `Option`
--> src/lib.rs:559:14
|
559 | .map(|x| x.highlight_child_mut())
| ______________^
560 | | .flatten()
| |______________________^ help: try replacing `map` with `and_then` and remove the `.flatten()`: `and_then(|x| x.highlight_child_mut())`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten
= note: `#[warn(clippy::map_flatten)]` on by default
|
you should consider adding a `Default` implementation for `Menu<T>`:
src/lib.rs#L583
warning: you should consider adding a `Default` implementation for `Menu<T>`
--> src/lib.rs:583:5
|
583 | / pub fn new() -> Self {
584 | | Self {
585 | | highlight_item_style: Style::default().fg(Color::White).bg(Color::LightBlue),
586 | | default_item_style: Style::default().fg(Color::White),
... |
590 | | }
591 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
= note: `#[warn(clippy::new_without_default)]` on by default
help: try adding this
|
582 + impl<T> Default for Menu<T> {
583 + fn default() -> Self {
584 + Self::new()
585 + }
586 + }
|
|