-
Notifications
You must be signed in to change notification settings - Fork 247
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
Few nits and clippy warnings #787
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--bin might've worked on cargo cca. 2018 ? unsure but --example works today
cargo test --release ...if anyone ever tries that.
the following are fixed: warning: redundant pattern matching, consider using `is_some()` --> /home/user/1tmp/ncurses_things/cursive/cursive-macros/src/builder/recipe.rs:354:16 | 354 | if let Some(_) = is_option_type(&field.ty) { | -------^^^^^^^---------------------------- help: try: `if is_option_type(&field.ty).is_some()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching = note: `#[warn(clippy::redundant_pattern_matching)]` on by default warning: unneeded `return` statement --> /home/user/1tmp/ncurses_things/cursive/cursive-macros/src/builder/recipe.rs:576:9 | 576 | / return Ok(RecipeAttributes { 577 | | base, 578 | | base_parameters, 579 | | name, 580 | | }); | |__________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return = note: `#[warn(clippy::needless_return)]` on by default help: remove `return` | 576 ~ Ok(RecipeAttributes { 577 + base, 578 + base_parameters, 579 + name, 580 ~ }) | warning: use of `unwrap_or_else` to construct default value --> /home/user/1tmp/ncurses_things/cursive/cursive-macros/src/builder/recipe.rs:561:49 | 561 | let mut name = base_default_name(&base).unwrap_or_else(String::new); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default = note: `#[warn(clippy::unwrap_or_default)]` on by default warning: this expression creates a reference which is immediately dereferenced by the compiler --> /home/user/1tmp/ncurses_things/cursive/cursive-core/src/views/dialog.rs:35:59 | 35 | if let Ok(string) = context.resolve::<String>(&config) { | ^^^^^^^ help: change this to: `config` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `#[warn(clippy::needless_borrow)]` on by default warning: this expression creates a reference which is immediately dereferenced by the compiler --> /home/user/1tmp/ncurses_things/cursive/cursive-core/src/views/dialog.rs:43:56 | 43 | if let Ok(obj) = context.resolve::<Object>(&config) { | ^^^^^^^ help: change this to: `config` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
the following are fixed: warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do --> /home/user/1tmp/ncurses_things/cursive/cursive/src/backends/puppet/observed.rs:422:41 | 422 | fn get_observed_screen(fake_screen: &Vec<&str>) -> ObservedScreen { | ^^^^^^^^^^ help: change this to: `&[&str]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg = note: `#[warn(clippy::ptr_arg)]` on by default warning: `cursive` (lib test) generated 1 warning warning: statics have by default a `'static` lifetime --> /home/user/1tmp/ncurses_things/cursive/cursive/examples/autocomplete.rs:10:17 | 10 | static CITIES: &'static str = include_str!("assets/cities.txt"); | -^^^^^^^---- help: consider removing `'static`: `&str` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default
warnings fixed: warning: manual implementation of `str::repeat` using iterators --> /home/user/1tmp/ncurses_things/cursive/cursive/examples/builder.rs:77:30 | 77 | let spaces: String = std::iter::repeat(" ") | ______________________________^ 78 | | .take(cursor + "You wrote `".len()) 79 | | .collect(); | |______________________^ help: try: `" ".repeat(cursor + "You wrote `".len())` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_str_repeat = note: `#[warn(clippy::manual_str_repeat)]` on by default
gyscos
approved these changes
Jun 6, 2024
Thanks for the work! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.