Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Fix more nightly Clippy lints #4238

Merged
merged 2 commits into from
Feb 25, 2023
Merged

Fix more nightly Clippy lints #4238

merged 2 commits into from
Feb 25, 2023

Conversation

andersk
Copy link
Contributor

@andersk andersk commented Feb 25, 2023

Summary

Run cargo clippy --fix with nightly Clippy.

Test Plan

cargo clippy.

Documentation

  • The PR requires documentation
  • I will create a new PR to update the documentation

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
…_element_list

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
@netlify
Copy link

netlify bot commented Feb 25, 2023

Deploy Preview for docs-rometools ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit b4985a6
🔍 Latest deploy log https://app.netlify.com/sites/docs-rometools/deploys/63fa44d2804da70008fec00c
😎 Deploy Preview https://deploy-preview-4238--docs-rometools.netlify.app/playground
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@ematipico
Copy link
Contributor

Out of curiosity, what are the error messages given by clippy around the elision of into_iter?

@andersk
Copy link
Contributor Author

andersk commented Feb 25, 2023

warning: useless conversion to the same type: `std::str::Split<'_, char>`
   --> xtask/coverage/src/ts/ts_microsoft.rs:127:21
    |
127 | /                     option_value
128 | |                         .split(',')
129 | |                         .into_iter()
    | |____________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
    = note: `#[warn(clippy::useless_conversion)]` on by default
help: consider removing `.into_iter()`
    |
127 ~                     option_value
128 +                         .split(',')
    |

warning: useless conversion to the same type: `impl std::iter::Iterator<Item = rome_rowan::SyntaxNode<rome_js_syntax::JsLanguage>>`
  --> crates/rome_js_analyze/src/analyzers/nursery/use_enum_initializers.rs:94:33
   |
94 |           let prev_enum_members = enum_member
   |  _________________________________^
95 | |             .syntax()
96 | |             .siblings(Direction::Prev)
97 | |             .into_iter()
   | |________________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
   = note: `#[warn(clippy::useless_conversion)]` on by default
help: consider removing `.into_iter()`
   |
94 ~         let prev_enum_members = enum_member
95 +             .syntax()
96 +             .siblings(Direction::Prev)
   |

warning: useless conversion to the same type: `impl std::iter::Iterator<Item = rome_js_syntax::AnyJsExpression>`
   --> crates/rome_js_analyze/src/semantic_analyzers/nursery/use_exhaustive_dependencies.rs:443:50
    |
443 |               let deps: Vec<(String, TextRange)> = result
    |  __________________________________________________^
444 | |                 .all_dependencies()
445 | |                 .into_iter()
    | |____________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
help: consider removing `.into_iter()`
    |
443 ~             let deps: Vec<(String, TextRange)> = result
444 +                 .all_dependencies()
    |

warning: this `impl` can be derived
   --> crates/rome_js_formatter/src/js/lists/template_element_list.rs:158:1
    |
158 | / impl Default for TemplateElementLayout {
159 | |     fn default() -> Self {
160 | |         TemplateElementLayout::Fit
161 | |     }
162 | | }
    | |_^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
    = note: `#[warn(clippy::derivable_impls)]` on by default
    = help: remove the manual implementation...
help: ...and instead derive it...
    |
149 | #[derive(Default)]
    |
help: ...and mark the default variant
    |
155 ~     #[default]
156 ~     Fit,
    |

warning: useless conversion to the same type: `std::fs::ReadDir`
   --> crates/rome_cli/src/commands/daemon.rs:155:23
    |
155 |       let most_recent = fs::read_dir(logs_dir)?
    |  _______________________^
156 | |         .into_iter()
    | |____________________^ help: consider removing `.into_iter()`: `fs::read_dir(logs_dir)?`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
    = note: `#[warn(clippy::useless_conversion)]` on by default

warning: useless conversion to the same type: `std::collections::hash_map::IntoIter<std::path::PathBuf, std::sync::Arc<lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex, std::vec::Vec<u8>>>>`
   --> crates/rome_cli/tests/snap_test.rs:253:29
    |
253 |           let files: Vec<_> = fs
    |  _____________________________^
254 | |             .files()
255 | |             .into_iter()
    | |________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
    = note: `#[warn(clippy::useless_conversion)]` on by default
help: consider removing `.into_iter()`
    |
253 ~         let files: Vec<_> = fs
254 +             .files()
    |

@ematipico ematipico added this pull request to the merge queue Feb 25, 2023
Merged via the queue into rome:main with commit 996775c Feb 25, 2023
@andersk andersk deleted the clippy branch February 25, 2023 18:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants