needless declarations (#2794)
* needless declarations
* fix build
* needless annotations
diff --git a/bindgen-integration/build.rs b/bindgen-integration/build.rs
index b5afeba..6b06c91 100644
--- a/bindgen-integration/build.rs
+++ b/bindgen-integration/build.rs
@@ -1,5 +1,4 @@
extern crate bindgen;
-extern crate cc;
use bindgen::callbacks::{
DeriveInfo, IntKind, MacroParsingBehavior, ParseCallbacks,
diff --git a/bindgen-integration/src/lib.rs b/bindgen-integration/src/lib.rs
index e234477..c37055e 100755
--- a/bindgen-integration/src/lib.rs
+++ b/bindgen-integration/src/lib.rs
@@ -12,7 +12,6 @@
use std::mem;
use std::os::raw::c_int;
-#[allow(unused)]
use bindings::testing::Bar; // This type is generated from module_raw_line.
type MacroInteger = isize;
diff --git a/bindgen-tests/tests/expectations/tests/dynamic_loading_attributes.rs b/bindgen-tests/tests/expectations/tests/dynamic_loading_attributes.rs
index 7682884..a1fb1b0 100644
--- a/bindgen-tests/tests/expectations/tests/dynamic_loading_attributes.rs
+++ b/bindgen-tests/tests/expectations/tests/dynamic_loading_attributes.rs
@@ -1,5 +1,4 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-extern crate libloading;
pub struct TestLib {
__library: ::libloading::Library,
pub foo: unsafe extern "C" fn(
diff --git a/bindgen-tests/tests/expectations/tests/dynamic_loading_required.rs b/bindgen-tests/tests/expectations/tests/dynamic_loading_required.rs
index 6fd97e4..5c929ff 100644
--- a/bindgen-tests/tests/expectations/tests/dynamic_loading_required.rs
+++ b/bindgen-tests/tests/expectations/tests/dynamic_loading_required.rs
@@ -1,5 +1,4 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-extern crate libloading;
pub struct TestLib {
__library: ::libloading::Library,
pub foo: unsafe extern "C" fn(
diff --git a/bindgen-tests/tests/expectations/tests/dynamic_loading_simple.rs b/bindgen-tests/tests/expectations/tests/dynamic_loading_simple.rs
index cdacf3a..9a4cfaf 100644
--- a/bindgen-tests/tests/expectations/tests/dynamic_loading_simple.rs
+++ b/bindgen-tests/tests/expectations/tests/dynamic_loading_simple.rs
@@ -1,5 +1,4 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-extern crate libloading;
pub struct TestLib {
__library: ::libloading::Library,
pub foo: Result<
diff --git a/bindgen-tests/tests/expectations/tests/dynamic_loading_template.rs b/bindgen-tests/tests/expectations/tests/dynamic_loading_template.rs
index 65c36e4..65f079b 100644
--- a/bindgen-tests/tests/expectations/tests/dynamic_loading_template.rs
+++ b/bindgen-tests/tests/expectations/tests/dynamic_loading_template.rs
@@ -1,5 +1,4 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-extern crate libloading;
pub struct TestLib {
__library: ::libloading::Library,
pub foo: Result<
diff --git a/bindgen-tests/tests/expectations/tests/dynamic_loading_with_allowlist.rs b/bindgen-tests/tests/expectations/tests/dynamic_loading_with_allowlist.rs
index 06fffc3..e65176b 100644
--- a/bindgen-tests/tests/expectations/tests/dynamic_loading_with_allowlist.rs
+++ b/bindgen-tests/tests/expectations/tests/dynamic_loading_with_allowlist.rs
@@ -1,5 +1,4 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-extern crate libloading;
pub struct TestLib {
__library: ::libloading::Library,
pub foo: Result<
diff --git a/bindgen-tests/tests/expectations/tests/dynamic_loading_with_blocklist.rs b/bindgen-tests/tests/expectations/tests/dynamic_loading_with_blocklist.rs
index 9273583..4908159 100644
--- a/bindgen-tests/tests/expectations/tests/dynamic_loading_with_blocklist.rs
+++ b/bindgen-tests/tests/expectations/tests/dynamic_loading_with_blocklist.rs
@@ -37,7 +37,6 @@
__bindgen_tmp.assume_init()
}
}
-extern crate libloading;
pub struct TestLib {
__library: ::libloading::Library,
pub foo: Result<
diff --git a/bindgen-tests/tests/expectations/tests/dynamic_loading_with_class.rs b/bindgen-tests/tests/expectations/tests/dynamic_loading_with_class.rs
index dd0544b..694d7e4 100644
--- a/bindgen-tests/tests/expectations/tests/dynamic_loading_with_class.rs
+++ b/bindgen-tests/tests/expectations/tests/dynamic_loading_with_class.rs
@@ -37,7 +37,6 @@
__bindgen_tmp.assume_init()
}
}
-extern crate libloading;
pub struct TestLib {
__library: ::libloading::Library,
pub foo: Result<
diff --git a/bindgen-tests/tests/expectations/tests/wrap_unsafe_ops_dynamic_loading_simple.rs b/bindgen-tests/tests/expectations/tests/wrap_unsafe_ops_dynamic_loading_simple.rs
index 968f10f..2f5b4cc 100644
--- a/bindgen-tests/tests/expectations/tests/wrap_unsafe_ops_dynamic_loading_simple.rs
+++ b/bindgen-tests/tests/expectations/tests/wrap_unsafe_ops_dynamic_loading_simple.rs
@@ -1,5 +1,4 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-extern crate libloading;
pub struct TestLib {
__library: ::libloading::Library,
pub foo: Result<
diff --git a/bindgen-tests/tests/quickchecking/src/bin.rs b/bindgen-tests/tests/quickchecking/src/bin.rs
index 7f1307e..fcd5665 100644
--- a/bindgen-tests/tests/quickchecking/src/bin.rs
+++ b/bindgen-tests/tests/quickchecking/src/bin.rs
@@ -14,8 +14,6 @@
//! ```
//!
#![deny(missing_docs)]
-extern crate clap;
-extern crate quickchecking;
use clap::{Arg, ArgAction, Command};
use std::path::PathBuf;
diff --git a/bindgen-tests/tests/quickchecking/src/lib.rs b/bindgen-tests/tests/quickchecking/src/lib.rs
index 631c1c6..38da62f 100644
--- a/bindgen-tests/tests/quickchecking/src/lib.rs
+++ b/bindgen-tests/tests/quickchecking/src/lib.rs
@@ -3,8 +3,6 @@
//! ## Example
//!
//! ```rust
-//! extern crate quickcheck;
-//! extern crate quickchecking;
//! use quickcheck::{Arbitrary, Gen};
//! use quickchecking::fuzzers;
//!
@@ -20,8 +18,6 @@
#![deny(missing_docs)]
#[macro_use]
extern crate lazy_static;
-extern crate quickcheck;
-extern crate tempfile;
use quickcheck::{Gen, QuickCheck, TestResult};
use std::error::Error;
diff --git a/bindgen-tests/tests/quickchecking/tests/fuzzed-c-headers.rs b/bindgen-tests/tests/quickchecking/tests/fuzzed-c-headers.rs
index e394efe..0735a70 100644
--- a/bindgen-tests/tests/quickchecking/tests/fuzzed-c-headers.rs
+++ b/bindgen-tests/tests/quickchecking/tests/fuzzed-c-headers.rs
@@ -1,6 +1,3 @@
-extern crate quickcheck;
-extern crate quickchecking;
-
use quickcheck::{Arbitrary, Gen};
use quickchecking::fuzzers::{
ArrayDimensionC, BaseTypeC, BasicTypeDeclarationC, DeclarationC,
diff --git a/bindgen-tests/tests/stylo_sanity.rs b/bindgen-tests/tests/stylo_sanity.rs
index e9ec69b..7b94e29 100755
--- a/bindgen-tests/tests/stylo_sanity.rs
+++ b/bindgen-tests/tests/stylo_sanity.rs
@@ -1,7 +1,3 @@
-// Don't want to copy that nasty `cfg` below...
-#[allow(unused_extern_crates)]
-extern crate bindgen;
-
/// A sanity test that we can generate bindings for Stylo.
///
/// We don't assert on expected output because its just too big. The output will
diff --git a/bindgen-tests/tests/tests.rs b/bindgen-tests/tests/tests.rs
index c096b2e..e6c038a 100644
--- a/bindgen-tests/tests/tests.rs
+++ b/bindgen-tests/tests/tests.rs
@@ -1,9 +1,3 @@
-extern crate bindgen;
-extern crate clap;
-#[cfg(feature = "logging")]
-extern crate env_logger;
-extern crate shlex;
-
use bindgen::{clang_version, Builder};
use owo_colors::{OwoColorize, Style};
use similar::{ChangeTag, TextDiff};
diff --git a/bindgen/codegen/dyngen.rs b/bindgen/codegen/dyngen.rs
index c067fad..b26c0b1 100644
--- a/bindgen/codegen/dyngen.rs
+++ b/bindgen/codegen/dyngen.rs
@@ -90,8 +90,6 @@
};
quote! {
- extern crate libloading;
-
pub struct #lib_ident {
__library: ::libloading::Library,
#(#struct_members)*
diff --git a/bindgen/features.rs b/bindgen/features.rs
index fa3f20d..6ac1d6a 100644
--- a/bindgen/features.rs
+++ b/bindgen/features.rs
@@ -231,7 +231,6 @@
#[cfg(test)]
mod test {
- #![allow(unused_imports)]
use super::*;
#[test]
diff --git a/book/src/non-system-libraries.md b/book/src/non-system-libraries.md
index d5d288d..b080db8 100644
--- a/book/src/non-system-libraries.md
+++ b/book/src/non-system-libraries.md
@@ -17,8 +17,6 @@
library:
```rust,ignore
-extern crate bindgen;
-
use std::env;
use std::path::PathBuf;