-
Notifications
You must be signed in to change notification settings - Fork 185
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
Fix cargo clippy warnings in data provider code #162
Conversation
Pull Request Test Coverage Report for Build 8a09ae6b8b41947ba0c6bc2c99b43b339f69c1a6-PR-162
💛 - Coveralls |
In callers, instead of including |
Thanks. The problem with .parse is that the compiler often doesn't have enough information to infer the type. I find FromStr clearer when the primary goal is constructing an object. let a: A = "foo".parse();
let a = A::from_str("foo"); What level is your comment? If your comment is optional, I'd rather leave it as-is. If your comment is suggestion or required, I'll take your advice and change it. |
In my experience that's actually a good thing. It basically means that if the context is strong enough (for example, you're passing the In result, I'm quite flexibly using both in my experience but found myself using
Suggestion, optional. Feel free to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated #161 according to your comments to make the clippy linting strict as it should be (fail on warnings). When I run this PR with the new strict check command -- cargo clean && cargo clippy --all-targets --all-features -- -D warnings
-- I get a couple of new warnings (errors), but they're minor:
error: Constants have by default a `'static` lifetime
--> components/data-provider-json/tests/test_no_std.rs:11:14
|
11 | const DATA: &'static str = r#"{
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
= note: `-D clippy::redundant-static-lifetimes` implied by `-D warnings`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes
error: unneeded `return` statement
--> components/data-provider-json/tests/test_no_std.rs:26:5
|
26 | / return provider
27 | | .load(&datap::Request {
28 | | langid: "en-US".parse().unwrap(),
29 | | category: datap::Category::Decimal,
... |
32 | | })
33 | | .unwrap();
| |__________________^
|
= note: `-D clippy::needless-return` implied by `-D warnings`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
26 | provider
27 | .load(&datap::Request {
28 | langid: "en-US".parse().unwrap(),
29 | category: datap::Category::Decimal,
30 | key: datap::decimal::Key::SymbolsV1.into(),
31 | payload: None,
...
error: this import is redundant
--> components/data-provider-json/tests/test_file_io.rs:1:1
|
1 | use icu_data_provider_json;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it entirely
|
= note: `-D clippy::single-component-path-imports` implied by `-D warnings`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_component_path_imports
error: aborting due to 2 previous errors
error: could not compile `icu-data-provider-json`.
To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: aborting due to previous error
error: could not compile `icu-data-provider-json`.
To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
I fixed the additional warnings uncovered by |
Don't forget the
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last little clippy warning to clear. I put the details in this comment
Odd, because I don't get that warning on my computer.
|
OK, I ran |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
FYI, this PR here needs to be merged first before #161 can be merged.
@zbraniecki @nciric I need at least one approval from a code owner |
Wait until #160 is ready before merging this one.