Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(lint): fix new lint warnings #1178

Merged
merged 2 commits into from
Jun 14, 2024

Conversation

EdJoPaTo
Copy link
Contributor

No description provided.

Copy link

codecov bot commented Jun 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.3%. Comparing base (d370aa7) to head (b7b8b41).

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1178   +/-   ##
=====================================
  Coverage   94.3%   94.3%           
=====================================
  Files         60      60           
  Lines      14677   14677           
=====================================
  Hits       13841   13841           
  Misses       836     836           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@joshka joshka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What were the warnings that were fixed?

@EdJoPaTo
Copy link
Contributor Author

warning: usage of a legacy numeric method
  --> src/layout/rect.rs:61:29
   |
61 |         let max_area = u16::max_value();
   |                             ^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants
   = note: `#[warn(clippy::legacy_numeric_constants)]` on by default
help: use the associated constant instead
   |
61 |         let max_area = u16::MAX;
   |                             ~~~

warning: unnecessary structure name repetition
  --> src/style/palette_conversion.rs:26:9
   |
26 |         Color::Rgb(red, green, blue)
   |         ^^^^^ help: use the applicable keyword: `Self`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
   = note: requested on the command line with `-W clippy::use-self`

warning: unnecessary structure name repetition
  --> src/style/palette_conversion.rs:51:9
   |
51 |         Color::from(srgb_color)
   |         ^^^^^ help: use the applicable keyword: `Self`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self

warning: `ratatui` (lib) generated 3 warnings (run `cargo clippy --fix --lib -p ratatui` to apply 2 suggestions)
warning: `ratatui` (lib test) generated 3 warnings (3 duplicates)
warning: unnecessary structure name repetition
   --> examples/demo/app.rs:125:41
    |
125 |     pub fn new(titles: Vec<&'a str>) -> TabsState {
    |                                         ^^^^^^^^^ help: use the applicable keyword: `Self`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
    = note: requested on the command line with `-W clippy::use-self`

warning: `ratatui` (example "demo") generated 1 warning (run `cargo clippy --fix --example "demo"` to apply 1 suggestion)

@EdJoPaTo
Copy link
Contributor Author

nightly has even more warnings… not sure whether I should include them in this PR.

warning: doc list item missing indentation
 --> src/text.rs:8:5
  |
8 | //! [`Text`].
  |     ^
  |
  = help: if this is supposed to be its own paragraph, add a blank line
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
  = note: `#[warn(clippy::doc_lazy_continuation)]` on by default
help: indent this line
  |
8 | //!   [`Text`].
  |     ++

warning: doc list item missing indentation
   --> src/widgets/block.rs:222:9
    |
222 |     /// the leftover space)
    |         ^
    |
    = help: if this is supposed to be its own paragraph, add a blank line
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
help: indent this line
    |
222 |     ///   the leftover space)
    |         ++

warning: doc list item missing indentation
   --> src/widgets/list.rs:377:5
    |
377 | /// multi-line items
    |     ^
    |
    = help: if this is supposed to be its own paragraph, add a blank line
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
help: indent this line
    |
377 | ///   multi-line items
    |     ++

warning: this could be a `const fn`
  --> src/widgets/reflow.rs:52:5
   |
52 | /     pub fn new(lines: O, max_line_width: u16, trim: bool) -> Self {
53 | |         Self {
54 | |             input_lines: lines,
55 | |             max_line_width,
...  |
60 | |         }
61 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
   = note: requested on the command line with `-W clippy::missing-const-for-fn`

warning: this could be a `const fn`
   --> src/widgets/reflow.rs:251:5
    |
251 | /     pub fn new(lines: O, max_line_width: u16) -> Self {
252 | |         Self {
253 | |             input_lines: lines,
254 | |             max_line_width,
...   |
257 | |         }
258 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn

warning: `ratatui` (lib) generated 5 warnings
warning: this could be a `const fn`
   --> examples/demo/app.rs:125:5
    |
125 | /     pub fn new(titles: Vec<&'a str>) -> Self {
126 | |         Self { titles, index: 0 }
127 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
    = note: requested on the command line with `-W clippy::missing-const-for-fn`

warning: `ratatui` (example "demo") generated 1 warning
warning: the borrowed expression implements the required traits
   --> src/widgets/table/table.rs:918:45
    |
918 |         let table = Table::default().widths(&vec![Constraint::Length(100)]);
    |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `vec![Constraint::Length(100)]`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
    = note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default

warning: `ratatui` (lib test) generated 6 warnings (5 duplicates) (run `cargo clippy --fix --lib -p ratatui --tests` to apply 1 suggestion)

@joshka
Copy link
Member

joshka commented Jun 14, 2024

Thanks for listing those off.

nightly has even more warnings… not sure whether I should include them in this PR.

Yeah, probably another PR

@EdJoPaTo EdJoPaTo merged commit 7d175f8 into ratatui:main Jun 14, 2024
33 checks passed
@EdJoPaTo EdJoPaTo deleted the new-lint-warnings branch June 14, 2024 09:26
itsjunetime pushed a commit to itsjunetime/ratatui that referenced this pull request Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants