From adb5d034ddf3bb3127ed6a18274da1f385edeff0 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Mon, 1 Apr 2024 22:12:56 +0200 Subject: [PATCH] needless declarations (#2794) * needless declarations * fix build * needless annotations --- bindgen-integration/build.rs | 1 - bindgen-integration/src/lib.rs | 1 - .../tests/expectations/tests/dynamic_loading_attributes.rs | 1 - .../tests/expectations/tests/dynamic_loading_required.rs | 1 - .../tests/expectations/tests/dynamic_loading_simple.rs | 1 - .../tests/expectations/tests/dynamic_loading_template.rs | 1 - .../expectations/tests/dynamic_loading_with_allowlist.rs | 1 - .../expectations/tests/dynamic_loading_with_blocklist.rs | 1 - .../tests/expectations/tests/dynamic_loading_with_class.rs | 1 - .../tests/wrap_unsafe_ops_dynamic_loading_simple.rs | 1 - bindgen-tests/tests/quickchecking/src/bin.rs | 2 -- bindgen-tests/tests/quickchecking/src/lib.rs | 4 ---- bindgen-tests/tests/quickchecking/tests/fuzzed-c-headers.rs | 3 --- bindgen-tests/tests/stylo_sanity.rs | 4 ---- bindgen-tests/tests/tests.rs | 6 ------ bindgen/codegen/dyngen.rs | 2 -- bindgen/features.rs | 1 - book/src/non-system-libraries.md | 2 -- 18 files changed, 34 deletions(-) diff --git a/bindgen-integration/build.rs b/bindgen-integration/build.rs index b5afeba92f..6b06c91bc3 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 e234477080..c37055ee7d 100755 --- a/bindgen-integration/src/lib.rs +++ b/bindgen-integration/src/lib.rs @@ -12,7 +12,6 @@ use std::ffi::CStr; 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 7682884bbb..a1fb1b0cc1 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 6fd97e4a46..5c929ffc3d 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 cdacf3ab42..9a4cfaf570 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 65c36e4893..65f079bede 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 06fffc3d47..e65176b863 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 9273583a5f..4908159826 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 @@ impl X { __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 dd0544b050..694d7e4ad5 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 @@ impl A { __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 968f10f6e5..2f5b4cc5ba 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 7f1307e15f..fcd56652be 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 631c1c679e..38da62f6ee 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 e394efe387..0735a70c47 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 e9ec69bcb8..7b94e2989e 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 c096b2e81e..e6c038a064 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 c067fada0e..b26c0b1817 100644 --- a/bindgen/codegen/dyngen.rs +++ b/bindgen/codegen/dyngen.rs @@ -90,8 +90,6 @@ impl DynamicItems { }; quote! { - extern crate libloading; - pub struct #lib_ident { __library: ::libloading::Library, #(#struct_members)* diff --git a/bindgen/features.rs b/bindgen/features.rs index fa3f20d717..6ac1d6a16d 100644 --- a/bindgen/features.rs +++ b/bindgen/features.rs @@ -231,7 +231,6 @@ impl Default for RustFeatures { #[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 d5d288d101..b080db80d7 100644 --- a/book/src/non-system-libraries.md +++ b/book/src/non-system-libraries.md @@ -17,8 +17,6 @@ Given that the library has not been compiled yet, we need to modify the library: ```rust,ignore -extern crate bindgen; - use std::env; use std::path::PathBuf;