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

Truncated message #2379

Closed
fpoli opened this issue Jan 18, 2018 · 4 comments
Closed

Truncated message #2379

fpoli opened this issue Jan 18, 2018 · 4 comments
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@fpoli
Copy link

fpoli commented Jan 18, 2018

I recently got the following message:

warning: use of `unwrap_or` followed by a function call
  --> jni-gen/src/generators/module.rs:17:24
   |
17 |       let modules_tree = modules
   |  ________________________^
18 | |         .visit(|modules| {
19 | |             let modules: HashMap<String, Option<String>> = modules;
20 | |             let mut res: Vec<String> = vec![];
...  |
36 | |         })
37 | |         .unwrap_or("// No modules".to_string());
   | |_______________________________________________^
   |
   = note: #[warn(or_fun_call)] on by default
   = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.180/index.html#or_fun_call
help: try this
   |
17 |     let modules_tree = modules
18 |         .visit(|modules| {
19 |             let modules: HashMap<String, Option<String>> = modules;
20 |             let mut res: Vec<String> = vec![];
21 |             for (name, opt_rec_result) in modules {
22 |                 match opt_rec_result {
 ...

The issue is that the suggested change regarding unwrap_or is not shown.

@oli-obk oli-obk added the C-bug Category: Clippy is not doing the correct thing label Jan 19, 2018
@theotherphil
Copy link
Contributor

I'm going to be looking at or_fun_call this coming weekend to implement #2338. I'll fix this then if the issue is still open.

@oli-obk
Copy link
Contributor

oli-obk commented Jan 22, 2018

I fear this is something that needs to be fixed in rustc.

@tesuji
Copy link
Contributor

tesuji commented May 2, 2020

I believed this is fixed.

@phansch
Copy link
Member

phansch commented May 2, 2020

Yeah, the or_fun_call lint now has a much smaller suggestion span so this should indeed be fixed

@phansch phansch closed this as completed May 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing
Projects
None yet
Development

No branches or pull requests

5 participants