Canop
October 22, 2019, 3:38pm
1
In a library, we have code like this one:
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::result::Result<(), ::std::fmt::Error> {
I think we compile the same way, with rustc 1.38, at the library level, with cargo test
(we thus have the same Cargo.toml).
Some developers, when running cargo test
see the "hidden lifetime parameters in types are deprecated" warning.
Some others don't see it.
The warning is clear and I'm now used to fix it. What I don't understand is why some developers don't see it. What can explain this difference ?
::std::fmt::Formatter
has a lifetime parameter, so what it's saying is that you should change it to this:
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error>
Note that we have explicit elision of a lifetime ('_
), which is different to no lifetime at all, implicit elision of a lifetime.
Canop
October 22, 2019, 3:45pm
4
The warning is clear, and I already fixed many LOCs for this problem.
What I don't understand is why some developers don't see the warning.
Might it be some .cargo/config files ?
Note OP's question:
Canop:
Some developers, when running cargo test
see the "hidden lifetime parameters in types are deprecated" warning.
Some others don't see it.
What can explain this difference ?
What would cause some developers to see the warning, others not, for the same piece of code?
2 Likes
Are they all running the latest rustc, and using the same channel? For example, rustc 1.38 msvc-windows-pc
Canop
October 22, 2019, 3:49pm
7
OK, found it, thanks to @shepmaster :
I had set an env flag:
RUSTFLAGS= -W rust_2018_idioms
4 Likes
system
Closed
January 20, 2020, 3:50pm
8
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.