error: `extern crate` is unnecessary in the new edition
--> src/main.rs:5:1
|
5 | extern crate libc;
| ^^^^^^^^^^^^^^^^^^ help: remove it
|
note: lint level defined here
--> src/main.rs:2:9
|
2 | #![deny(unnecessary_extern_crate)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
error: Could not compile `playground`.
The following code
generates an error:
but if the
extern crate libc;is removed it no longer compiles!This situation has come up on two occasions so far:
use libc;and rustfix rewrote it touse crate::libc;. This worked in the 2015 edition becauseextern crate libc;was declared at the top. Later thisunnecessary_extern_cratelint ended up showing the error above.cratelint for single-item paths #50665 theuse *;statement is entirely disallowed in the 2018 edition, so we instead recommend the replacementuse crate::*;. This, however, will also break if one of the identifiers used is anextern crateas the lint currently suggests removingextern crate