1

How can I increase the number of source code lines shown in rustc or clippy messages? I have the problem that one of the changes suggested by clippy is truncated because it's too long.

For example, the warning message that I see is this:

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 {
 ...

And the problem is that the suggested change regarding the unwrap_or call is not shown.

Federico
  • 1,925
  • 14
  • 19
  • 1
    Frankly, that's just a bug with Clippy that you should report. – Shepmaster Jan 18 '18 at 15:49
  • 2
    FWIW, it's going to say `.unwrap_or_else(|| "// No modules".to_string());` – Shepmaster Jan 18 '18 at 15:50
  • 2
    Clippy dev here. We don't actually generate error messages ourselves, we just ask rustc to do it for us. If the message is cut before the end, it's rustc's decision. But I'd say it's also kinda your fault for making such a long expression, why not making the lambda a function? – mcarton Jan 18 '18 at 18:05

0 Answers0