Skip to content

Commit

Permalink
use visibility to check unused imports and delete some stmts
Browse files Browse the repository at this point in the history
  • Loading branch information
bvanjoi committed Oct 22, 2023
1 parent 724ba7f commit 482275b
Show file tree
Hide file tree
Showing 38 changed files with 133 additions and 55 deletions.
1 change: 0 additions & 1 deletion compiler/rustc_ast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ pub mod visit;

pub use self::ast::*;
pub use self::ast_traits::{AstDeref, AstNodeWrapper, HasAttrs, HasNodeId, HasSpan, HasTokens};
pub use self::format::*;

use rustc_data_structures::stable_hasher::{HashStable, StableHasher};

Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_codegen_llvm/src/debuginfo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ mod utils;

pub use self::create_scope_map::compute_mir_scopes;
pub use self::metadata::build_global_var_di_node;
pub use self::metadata::extend_scope_to_file;

#[allow(non_upper_case_globals)]
const DW_TAG_auto_variable: c_uint = 0x100;
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_codegen_llvm/src/mono_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use crate::llvm;
use crate::type_of::LayoutLlvmExt;
use rustc_codegen_ssa::traits::*;
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
pub use rustc_middle::mir::mono::MonoItem;
use rustc_middle::mir::mono::{Linkage, Visibility};
use rustc_middle::ty::layout::{FnAbiOf, LayoutOf};
use rustc_middle::ty::{self, Instance, TypeVisitableExt};
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ mod arg_matrix;
mod checks;
mod suggestions;

pub use _impl::*;
use rustc_errors::ErrorGuaranteed;
pub use suggestions::*;

use crate::coercion::DynamicCoerceMany;
use crate::{Diverges, EnclosingBreakables, Inherited};
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_infer/src/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use rustc_span::Span;

pub use self::FulfillmentErrorCode::*;
pub use self::ImplSource::*;
pub use self::ObligationCauseCode::*;
pub use self::SelectionError::*;

pub use self::engine::{TraitEngine, TraitEngineExt};
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_middle/src/mir/terminator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ use rustc_hir::LangItem;
use smallvec::SmallVec;

use super::{BasicBlock, InlineAsmOperand, Operand, SourceInfo, TerminatorKind, UnwindAction};
pub use rustc_ast::Mutability;
use rustc_macros::HashStable;
use std::iter;
use std::slice;

pub use super::query::*;
use super::*;

impl SwitchTargets {
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_middle/src/ty/assoc.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
pub use self::AssocItemContainer::*;

use crate::ty;
use rustc_data_structures::sorted_map::SortedIndexMultiMap;
use rustc_hir as hir;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_dataflow/src/framework/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ mod visitor;
pub use self::cursor::{AnalysisResults, ResultsClonedCursor, ResultsCursor, ResultsRefCursor};
pub use self::direction::{Backward, Direction, Forward};
pub use self::engine::{Engine, EntrySets, Results, ResultsCloned};
pub use self::lattice::{JoinSemiLattice, MaybeReachable, MeetSemiLattice};
pub use self::lattice::{JoinSemiLattice, MaybeReachable};
pub use self::visitor::{visit_results, ResultsVisitable, ResultsVisitor};

/// Analysis domains are all bitsets of various kinds. This trait holds
Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc_resolve/src/check_unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ struct UnusedImportCheckVisitor<'a, 'b, 'tcx> {
base_use_tree: Option<&'a ast::UseTree>,
base_id: ast::NodeId,
item_span: Span,
base_use_is_pub: bool,
}

struct ExternCrateToLint {
Expand Down Expand Up @@ -146,7 +145,6 @@ impl<'a, 'b, 'tcx> Visitor<'a> for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
// because this means that they were generated in some fashion by the
// compiler and we don't need to consider them.
ast::ItemKind::Use(..) if item.span.is_dummy() => return,
ast::ItemKind::Use(..) => self.base_use_is_pub = item.vis.kind.is_pub(),
ast::ItemKind::ExternCrate(orig_name) => {
self.extern_crate_items.push(ExternCrateToLint {
id: item.id,
Expand All @@ -173,7 +171,7 @@ impl<'a, 'b, 'tcx> Visitor<'a> for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
self.base_use_tree = Some(use_tree);
}

if self.base_use_is_pub {
if self.r.effective_visibilities.is_exported(self.r.local_def_id(id)) {
self.check_import_as_underscore(use_tree, id);
return;
}
Expand Down Expand Up @@ -332,7 +330,6 @@ impl Resolver<'_, '_> {
base_use_tree: None,
base_id: ast::DUMMY_NODE_ID,
item_span: DUMMY_SP,
base_use_is_pub: false,
};
visit::walk_crate(&mut visitor, krate);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use std::ops::ControlFlow;

pub use self::infer_ctxt_ext::*;
pub use self::type_err_ctxt_ext::*;
pub use rustc_infer::traits::error_reporting::*;

// When outputting impl candidates, prefer showing those that are more similar.
//
Expand Down
5 changes: 0 additions & 5 deletions compiler/rustc_trait_selection/src/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ use std::ops::ControlFlow;

pub(crate) use self::project::{needs_normalization, BoundVarReplacer, PlaceholderReplacer};

pub use self::FulfillmentErrorCode::*;
pub use self::ImplSource::*;
pub use self::ObligationCauseCode::*;
pub use self::SelectionError::*;

pub use self::coherence::{add_placeholder_note, orphan_check, overlapping_impls};
pub use self::coherence::{OrphanCheckErr, OverlapResult};
pub use self::engine::{ObligationCtxt, TraitEngineExt};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/traits/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rustc_middle::ty::{self, ImplSubject, ToPredicate, Ty, TyCtxt, TypeVisitable
use rustc_span::Span;
use smallvec::SmallVec;

pub use rustc_infer::traits::{self, util::*};
pub use rustc_infer::traits::util::*;

///////////////////////////////////////////////////////////////////////////
// `TraitAliasExpander` iterator
Expand Down
1 change: 1 addition & 0 deletions library/core/src/arch.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![doc = include_str!("../../stdarch/crates/core_arch/src/core_arch_docs.md")]

#[allow(unused_imports)]
#[stable(feature = "simd_arch", since = "1.27.0")]
pub use crate::core_arch::arch::*;

Expand Down
2 changes: 0 additions & 2 deletions library/core/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@
#![deny(unsafe_op_in_unsafe_fn)]
#![deny(fuzzy_provenance_casts)]

extern crate test;

mod alloc;
mod any;
mod array;
Expand Down
2 changes: 0 additions & 2 deletions library/core/tests/num/flt2dec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ use core::num::flt2dec::{
};
use core::num::fmt::{Formatted, Part};

pub use test::Bencher;

mod estimator;
mod strategy {
mod dragon;
Expand Down
1 change: 0 additions & 1 deletion library/portable-simd/crates/core_simd/src/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,5 @@ pub mod simd {
pub use crate::core_simd::masks::*;
pub use crate::core_simd::ord::*;
pub use crate::core_simd::swizzle::*;
pub use crate::core_simd::swizzle_dyn::*;
pub use crate::core_simd::vector::*;
}
1 change: 1 addition & 0 deletions library/std/src/sys/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

pub mod alloc;
pub mod small_c_string;
#[allow(unused_imports)]
pub mod thread_local;

#[cfg(test)]
Expand Down
1 change: 1 addition & 0 deletions library/std/src/sys/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ pub unsafe fn cleanup() {

#[cfg(target_os = "android")]
pub use crate::sys::android::signal;
#[allow(unused_imports)]
#[cfg(not(target_os = "android"))]
pub use libc::signal;

Expand Down
1 change: 0 additions & 1 deletion library/std/src/sys/unix/process/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
pub use self::process_common::{Command, CommandArgs, ExitCode, Stdio, StdioPipes};
pub use self::process_inner::{ExitStatus, ExitStatusError, Process};
pub use crate::ffi::OsString as EnvKey;
pub use crate::sys_common::process::CommandEnvs;

#[cfg_attr(any(target_os = "espidf", target_os = "horizon"), allow(unused))]
mod process_common;
Expand Down
1 change: 1 addition & 0 deletions library/std/src/sys/unix/process/process_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ cfg_if::cfg_if! {
return 0;
}
} else {
#[allow(unused_imports)]
pub use libc::{sigemptyset, sigaddset};
}
}
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui/enum_glob_use.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ mod in_fn_test {
}

mod blurg {
#[allow(unused_imports)]
pub use std::cmp::Ordering::*; // ok, re-export
}

Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui/enum_glob_use.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ mod in_fn_test {
}

mod blurg {
#[allow(unused_imports)]
pub use std::cmp::Ordering::*; // ok, re-export
}

Expand Down
1 change: 1 addition & 0 deletions src/tools/miri/tests/utils/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(dead_code)]
#![allow(unused_imports)]

#[macro_use]
mod macros;
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rust-analyzer/crates/parser/src/syntax_kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
mod generated;

#[allow(unreachable_pub)]
pub use self::generated::{SyntaxKind, T};
pub use self::generated::SyntaxKind;

impl From<u16> for SyntaxKind {
#[inline]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,4 +497,3 @@ impl SyntaxKind {
}
#[macro_export]
macro_rules ! T { [;] => { $ crate :: SyntaxKind :: SEMICOLON } ; [,] => { $ crate :: SyntaxKind :: COMMA } ; ['('] => { $ crate :: SyntaxKind :: L_PAREN } ; [')'] => { $ crate :: SyntaxKind :: R_PAREN } ; ['{'] => { $ crate :: SyntaxKind :: L_CURLY } ; ['}'] => { $ crate :: SyntaxKind :: R_CURLY } ; ['['] => { $ crate :: SyntaxKind :: L_BRACK } ; [']'] => { $ crate :: SyntaxKind :: R_BRACK } ; [<] => { $ crate :: SyntaxKind :: L_ANGLE } ; [>] => { $ crate :: SyntaxKind :: R_ANGLE } ; [@] => { $ crate :: SyntaxKind :: AT } ; [#] => { $ crate :: SyntaxKind :: POUND } ; [~] => { $ crate :: SyntaxKind :: TILDE } ; [?] => { $ crate :: SyntaxKind :: QUESTION } ; [$] => { $ crate :: SyntaxKind :: DOLLAR } ; [&] => { $ crate :: SyntaxKind :: AMP } ; [|] => { $ crate :: SyntaxKind :: PIPE } ; [+] => { $ crate :: SyntaxKind :: PLUS } ; [*] => { $ crate :: SyntaxKind :: STAR } ; [/] => { $ crate :: SyntaxKind :: SLASH } ; [^] => { $ crate :: SyntaxKind :: CARET } ; [%] => { $ crate :: SyntaxKind :: PERCENT } ; [_] => { $ crate :: SyntaxKind :: UNDERSCORE } ; [.] => { $ crate :: SyntaxKind :: DOT } ; [..] => { $ crate :: SyntaxKind :: DOT2 } ; [...] => { $ crate :: SyntaxKind :: DOT3 } ; [..=] => { $ crate :: SyntaxKind :: DOT2EQ } ; [:] => { $ crate :: SyntaxKind :: COLON } ; [::] => { $ crate :: SyntaxKind :: COLON2 } ; [=] => { $ crate :: SyntaxKind :: EQ } ; [==] => { $ crate :: SyntaxKind :: EQ2 } ; [=>] => { $ crate :: SyntaxKind :: FAT_ARROW } ; [!] => { $ crate :: SyntaxKind :: BANG } ; [!=] => { $ crate :: SyntaxKind :: NEQ } ; [-] => { $ crate :: SyntaxKind :: MINUS } ; [->] => { $ crate :: SyntaxKind :: THIN_ARROW } ; [<=] => { $ crate :: SyntaxKind :: LTEQ } ; [>=] => { $ crate :: SyntaxKind :: GTEQ } ; [+=] => { $ crate :: SyntaxKind :: PLUSEQ } ; [-=] => { $ crate :: SyntaxKind :: MINUSEQ } ; [|=] => { $ crate :: SyntaxKind :: PIPEEQ } ; [&=] => { $ crate :: SyntaxKind :: AMPEQ } ; [^=] => { $ crate :: SyntaxKind :: CARETEQ } ; [/=] => { $ crate :: SyntaxKind :: SLASHEQ } ; [*=] => { $ crate :: SyntaxKind :: STAREQ } ; [%=] => { $ crate :: SyntaxKind :: PERCENTEQ } ; [&&] => { $ crate :: SyntaxKind :: AMP2 } ; [||] => { $ crate :: SyntaxKind :: PIPE2 } ; [<<] => { $ crate :: SyntaxKind :: SHL } ; [>>] => { $ crate :: SyntaxKind :: SHR } ; [<<=] => { $ crate :: SyntaxKind :: SHLEQ } ; [>>=] => { $ crate :: SyntaxKind :: SHREQ } ; [as] => { $ crate :: SyntaxKind :: AS_KW } ; [async] => { $ crate :: SyntaxKind :: ASYNC_KW } ; [await] => { $ crate :: SyntaxKind :: AWAIT_KW } ; [box] => { $ crate :: SyntaxKind :: BOX_KW } ; [break] => { $ crate :: SyntaxKind :: BREAK_KW } ; [const] => { $ crate :: SyntaxKind :: CONST_KW } ; [continue] => { $ crate :: SyntaxKind :: CONTINUE_KW } ; [crate] => { $ crate :: SyntaxKind :: CRATE_KW } ; [do] => { $ crate :: SyntaxKind :: DO_KW } ; [dyn] => { $ crate :: SyntaxKind :: DYN_KW } ; [else] => { $ crate :: SyntaxKind :: ELSE_KW } ; [enum] => { $ crate :: SyntaxKind :: ENUM_KW } ; [extern] => { $ crate :: SyntaxKind :: EXTERN_KW } ; [false] => { $ crate :: SyntaxKind :: FALSE_KW } ; [fn] => { $ crate :: SyntaxKind :: FN_KW } ; [for] => { $ crate :: SyntaxKind :: FOR_KW } ; [if] => { $ crate :: SyntaxKind :: IF_KW } ; [impl] => { $ crate :: SyntaxKind :: IMPL_KW } ; [in] => { $ crate :: SyntaxKind :: IN_KW } ; [let] => { $ crate :: SyntaxKind :: LET_KW } ; [loop] => { $ crate :: SyntaxKind :: LOOP_KW } ; [macro] => { $ crate :: SyntaxKind :: MACRO_KW } ; [match] => { $ crate :: SyntaxKind :: MATCH_KW } ; [mod] => { $ crate :: SyntaxKind :: MOD_KW } ; [move] => { $ crate :: SyntaxKind :: MOVE_KW } ; [mut] => { $ crate :: SyntaxKind :: MUT_KW } ; [pub] => { $ crate :: SyntaxKind :: PUB_KW } ; [ref] => { $ crate :: SyntaxKind :: REF_KW } ; [return] => { $ crate :: SyntaxKind :: RETURN_KW } ; [self] => { $ crate :: SyntaxKind :: SELF_KW } ; [Self] => { $ crate :: SyntaxKind :: SELF_TYPE_KW } ; [static] => { $ crate :: SyntaxKind :: STATIC_KW } ; [struct] => { $ crate :: SyntaxKind :: STRUCT_KW } ; [super] => { $ crate :: SyntaxKind :: SUPER_KW } ; [trait] => { $ crate :: SyntaxKind :: TRAIT_KW } ; [true] => { $ crate :: SyntaxKind :: TRUE_KW } ; [try] => { $ crate :: SyntaxKind :: TRY_KW } ; [type] => { $ crate :: SyntaxKind :: TYPE_KW } ; [unsafe] => { $ crate :: SyntaxKind :: UNSAFE_KW } ; [use] => { $ crate :: SyntaxKind :: USE_KW } ; [where] => { $ crate :: SyntaxKind :: WHERE_KW } ; [while] => { $ crate :: SyntaxKind :: WHILE_KW } ; [yield] => { $ crate :: SyntaxKind :: YIELD_KW } ; [auto] => { $ crate :: SyntaxKind :: AUTO_KW } ; [builtin] => { $ crate :: SyntaxKind :: BUILTIN_KW } ; [default] => { $ crate :: SyntaxKind :: DEFAULT_KW } ; [existential] => { $ crate :: SyntaxKind :: EXISTENTIAL_KW } ; [union] => { $ crate :: SyntaxKind :: UNION_KW } ; [raw] => { $ crate :: SyntaxKind :: RAW_KW } ; [macro_rules] => { $ crate :: SyntaxKind :: MACRO_RULES_KW } ; [yeet] => { $ crate :: SyntaxKind :: YEET_KW } ; [offset_of] => { $ crate :: SyntaxKind :: OFFSET_OF_KW } ; [asm] => { $ crate :: SyntaxKind :: ASM_KW } ; [format_args] => { $ crate :: SyntaxKind :: FORMAT_ARGS_KW } ; [lifetime_ident] => { $ crate :: SyntaxKind :: LIFETIME_IDENT } ; [ident] => { $ crate :: SyntaxKind :: IDENT } ; [shebang] => { $ crate :: SyntaxKind :: SHEBANG } ; }
pub use T;
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,6 @@ fn generate_syntax_kinds(grammar: KindsSrc<'_>) -> String {
[ident] => { $crate::SyntaxKind::IDENT };
[shebang] => { $crate::SyntaxKind::SHEBANG };
}
pub use T;
};

sourcegen::add_preamble("sourcegen_ast", sourcegen::reformat(ast.to_string()))
Expand Down
2 changes: 2 additions & 0 deletions src/tools/rustfmt/src/config/options.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(unused_imports)]

use std::collections::{hash_set, HashSet};
use std::fmt;
use std::path::{Path, PathBuf};
Expand Down
25 changes: 25 additions & 0 deletions tests/ui/imports/pub-reexport-empty.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#![deny(unused_imports)]

mod a {}

pub use a::*;
//~^ ERROR: unused import: `a::*`

mod b {
mod c {
#[derive(Clone)]
pub struct D;
}
pub use self::c::*; // don't show unused import lint
}

pub use b::*; // don't show unused import lint

mod d {
const D: i32 = 1;
}

pub use d::*;
//~^ ERROR: unused import: `d::*`

fn main() {}
20 changes: 20 additions & 0 deletions tests/ui/imports/pub-reexport-empty.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
error: unused import: `a::*`
--> $DIR/pub-reexport-empty.rs:5:9
|
LL | pub use a::*;
| ^^^^
|
note: the lint level is defined here
--> $DIR/pub-reexport-empty.rs:1:9
|
LL | #![deny(unused_imports)]
| ^^^^^^^^^^^^^^

error: unused import: `d::*`
--> $DIR/pub-reexport-empty.rs:22:9
|
LL | pub use d::*;
| ^^^^

error: aborting due to 2 previous errors

5 changes: 4 additions & 1 deletion tests/ui/imports/reexports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ mod a {
mod foo {}

mod a {
pub use super::foo; //~ ERROR cannot be re-exported
pub use super::foo;
//~^ ERROR cannot be re-exported
//~| WARNING unused import: `super::foo`
pub use super::*;
//~^ WARNING glob import doesn't reexport anything because no candidate is public enough
//~| WARNING unused import: `super::*`
}
}

Expand Down
34 changes: 23 additions & 11 deletions tests/ui/imports/reexports.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,52 +11,64 @@ LL | pub use super::foo;
| ^^^^^^^^^^

error[E0603]: module import `foo` is private
--> $DIR/reexports.rs:33:15
--> $DIR/reexports.rs:36:15
|
LL | use b::a::foo::S;
| ^^^ private module import
|
note: the module import `foo` is defined here...
--> $DIR/reexports.rs:21:17
--> $DIR/reexports.rs:24:17
|
LL | pub use super::foo; // This is OK since the value `foo` is visible enough.
| ^^^^^^^^^^
note: ...and refers to the module `foo` which is defined here
--> $DIR/reexports.rs:16:5
--> $DIR/reexports.rs:19:5
|
LL | mod foo {
| ^^^^^^^

error[E0603]: module import `foo` is private
--> $DIR/reexports.rs:34:15
--> $DIR/reexports.rs:37:15
|
LL | use b::b::foo::S as T;
| ^^^ private module import
|
note: the module import `foo` is defined here...
--> $DIR/reexports.rs:26:17
--> $DIR/reexports.rs:29:17
|
LL | pub use super::*; // This is also OK since the value `foo` is visible enough.
| ^^^^^^^^
note: ...and refers to the module `foo` which is defined here
--> $DIR/reexports.rs:16:5
--> $DIR/reexports.rs:19:5
|
LL | mod foo {
| ^^^^^^^

warning: glob import doesn't reexport anything because no candidate is public enough
--> $DIR/reexports.rs:9:17
warning: unused import: `super::foo`
--> $DIR/reexports.rs:8:17
|
LL | pub use super::*;
| ^^^^^^^^
LL | pub use super::foo;
| ^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/reexports.rs:1:9
|
LL | #![warn(unused_imports)]
| ^^^^^^^^^^^^^^

error: aborting due to 3 previous errors; 1 warning emitted
warning: glob import doesn't reexport anything because no candidate is public enough
--> $DIR/reexports.rs:11:17
|
LL | pub use super::*;
| ^^^^^^^^

warning: unused import: `super::*`
--> $DIR/reexports.rs:11:17
|
LL | pub use super::*;
| ^^^^^^^^

error: aborting due to 3 previous errors; 3 warnings emitted

Some errors have detailed explanations: E0364, E0603.
For more information about an error, try `rustc --explain E0364`.
2 changes: 1 addition & 1 deletion tests/ui/lint/unused/lint-unused-imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ mod foo {
pub struct Square{pub p: Point, pub h: usize, pub w: usize}
}

mod bar {
pub mod bar {
// Don't ignore on 'pub use' because we're not sure if it's used or not
pub use std::cmp::PartialEq;
pub struct Square;
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/parser/recover-missing-semi-before-item.fixed
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// run-rustfix

#![allow(unused_variables, dead_code)]
#![allow(unused_variables, dead_code, unused_imports)]

fn for_struct() {
let foo = 3; //~ ERROR expected `;`, found keyword `struct`
Expand Down
Loading

0 comments on commit 482275b

Please sign in to comment.