With my preference for VIM, I'm considered an oddball. Most people work with Intelij, Visual Studio and other products on a daily basis. But there are good reasons to do without features like refactoring and code analysis.
Today I have found a suitable example. I used Intelij with the RUST plugin on my own code just to see what the IDE will suggest.
In the function test_find_entryindex_by_string() are the following lines of code.
; let out_str:String; (v, out_str) = find_entryindex_by_string(&q, &buf);
I leave the variables uninitialized because the function produces a result in any case.
q and buf are borrowed. So I can use them (or manipulate them in some cases) and fetch results on the other hand.
Typical things why I love Rust so much. I felt in love with the concept of memory management , livetimes and borrowing.
The IDE should be able to see that. Nevertheless, the Intelij CodeInspector highlighted the lines. And that leads inexperienced developers to change the lines. And the penetrating yellow color quickly attracts nitpickers, who then let a code review become a pure waste of time thanks to stupidity.
So I changed the Lines to make the Intelij CodeInspector happy...
let mut v:Vec
= vec!; let mut out_str:String = "".to_string(); (v, out_str) = find_entryindex_by_string(&q, &buf);
Apart from the fact that the code is now totally ugly (I used exactly the suggestion that the IDE made), it is absolutely buggy. The initial value is never used. We fill the memory with junk thanks to the IDE.
The Build has now this Result:
warning: value assigned to `v` is never read --> src/mem_buf.rs:171:17 | 171 | let mut v:Vec
= vec!; | ^ | = help: maybe it is overwritten before being read? warning: value assigned to `out_str` is never read --> src/mem_buf.rs:172:17 | 172 | let mut out_str:String = "".to_string(); | ^^^^^^^ | = help: maybe it is overwritten before being read?
Therefore it remains with my rule of thumb: IDEs are bloated power consumption monsters and compiler warnings are the measure of all things!