mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 02:03:53 +00:00
use visibility to check unused imports and delete some stmts
This commit is contained in:
parent
724ba7fe90
commit
482275b194
@ -53,7 +53,6 @@ pub mod visit;
|
|||||||
|
|
||||||
pub use self::ast::*;
|
pub use self::ast::*;
|
||||||
pub use self::ast_traits::{AstDeref, AstNodeWrapper, HasAttrs, HasNodeId, HasSpan, HasTokens};
|
pub use self::ast_traits::{AstDeref, AstNodeWrapper, HasAttrs, HasNodeId, HasSpan, HasTokens};
|
||||||
pub use self::format::*;
|
|
||||||
|
|
||||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||||
|
|
||||||
|
@ -50,7 +50,6 @@ mod utils;
|
|||||||
|
|
||||||
pub use self::create_scope_map::compute_mir_scopes;
|
pub use self::create_scope_map::compute_mir_scopes;
|
||||||
pub use self::metadata::build_global_var_di_node;
|
pub use self::metadata::build_global_var_di_node;
|
||||||
pub use self::metadata::extend_scope_to_file;
|
|
||||||
|
|
||||||
#[allow(non_upper_case_globals)]
|
#[allow(non_upper_case_globals)]
|
||||||
const DW_TAG_auto_variable: c_uint = 0x100;
|
const DW_TAG_auto_variable: c_uint = 0x100;
|
||||||
|
@ -6,7 +6,6 @@ use crate::llvm;
|
|||||||
use crate::type_of::LayoutLlvmExt;
|
use crate::type_of::LayoutLlvmExt;
|
||||||
use rustc_codegen_ssa::traits::*;
|
use rustc_codegen_ssa::traits::*;
|
||||||
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
|
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::mir::mono::{Linkage, Visibility};
|
||||||
use rustc_middle::ty::layout::{FnAbiOf, LayoutOf};
|
use rustc_middle::ty::layout::{FnAbiOf, LayoutOf};
|
||||||
use rustc_middle::ty::{self, Instance, TypeVisitableExt};
|
use rustc_middle::ty::{self, Instance, TypeVisitableExt};
|
||||||
|
@ -4,9 +4,7 @@ mod arg_matrix;
|
|||||||
mod checks;
|
mod checks;
|
||||||
mod suggestions;
|
mod suggestions;
|
||||||
|
|
||||||
pub use _impl::*;
|
|
||||||
use rustc_errors::ErrorGuaranteed;
|
use rustc_errors::ErrorGuaranteed;
|
||||||
pub use suggestions::*;
|
|
||||||
|
|
||||||
use crate::coercion::DynamicCoerceMany;
|
use crate::coercion::DynamicCoerceMany;
|
||||||
use crate::{Diverges, EnclosingBreakables, Inherited};
|
use crate::{Diverges, EnclosingBreakables, Inherited};
|
||||||
|
@ -19,7 +19,6 @@ use rustc_span::Span;
|
|||||||
|
|
||||||
pub use self::FulfillmentErrorCode::*;
|
pub use self::FulfillmentErrorCode::*;
|
||||||
pub use self::ImplSource::*;
|
pub use self::ImplSource::*;
|
||||||
pub use self::ObligationCauseCode::*;
|
|
||||||
pub use self::SelectionError::*;
|
pub use self::SelectionError::*;
|
||||||
|
|
||||||
pub use self::engine::{TraitEngine, TraitEngineExt};
|
pub use self::engine::{TraitEngine, TraitEngineExt};
|
||||||
|
@ -3,12 +3,10 @@ use rustc_hir::LangItem;
|
|||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
|
|
||||||
use super::{BasicBlock, InlineAsmOperand, Operand, SourceInfo, TerminatorKind, UnwindAction};
|
use super::{BasicBlock, InlineAsmOperand, Operand, SourceInfo, TerminatorKind, UnwindAction};
|
||||||
pub use rustc_ast::Mutability;
|
|
||||||
use rustc_macros::HashStable;
|
use rustc_macros::HashStable;
|
||||||
use std::iter;
|
use std::iter;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
|
|
||||||
pub use super::query::*;
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
impl SwitchTargets {
|
impl SwitchTargets {
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
pub use self::AssocItemContainer::*;
|
|
||||||
|
|
||||||
use crate::ty;
|
use crate::ty;
|
||||||
use rustc_data_structures::sorted_map::SortedIndexMultiMap;
|
use rustc_data_structures::sorted_map::SortedIndexMultiMap;
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
|
@ -48,7 +48,7 @@ mod visitor;
|
|||||||
pub use self::cursor::{AnalysisResults, ResultsClonedCursor, ResultsCursor, ResultsRefCursor};
|
pub use self::cursor::{AnalysisResults, ResultsClonedCursor, ResultsCursor, ResultsRefCursor};
|
||||||
pub use self::direction::{Backward, Direction, Forward};
|
pub use self::direction::{Backward, Direction, Forward};
|
||||||
pub use self::engine::{Engine, EntrySets, Results, ResultsCloned};
|
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};
|
pub use self::visitor::{visit_results, ResultsVisitable, ResultsVisitor};
|
||||||
|
|
||||||
/// Analysis domains are all bitsets of various kinds. This trait holds
|
/// Analysis domains are all bitsets of various kinds. This trait holds
|
||||||
|
@ -59,7 +59,6 @@ struct UnusedImportCheckVisitor<'a, 'b, 'tcx> {
|
|||||||
base_use_tree: Option<&'a ast::UseTree>,
|
base_use_tree: Option<&'a ast::UseTree>,
|
||||||
base_id: ast::NodeId,
|
base_id: ast::NodeId,
|
||||||
item_span: Span,
|
item_span: Span,
|
||||||
base_use_is_pub: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ExternCrateToLint {
|
struct ExternCrateToLint {
|
||||||
@ -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
|
// because this means that they were generated in some fashion by the
|
||||||
// compiler and we don't need to consider them.
|
// compiler and we don't need to consider them.
|
||||||
ast::ItemKind::Use(..) if item.span.is_dummy() => return,
|
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) => {
|
ast::ItemKind::ExternCrate(orig_name) => {
|
||||||
self.extern_crate_items.push(ExternCrateToLint {
|
self.extern_crate_items.push(ExternCrateToLint {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
@ -173,7 +171,7 @@ impl<'a, 'b, 'tcx> Visitor<'a> for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
|
|||||||
self.base_use_tree = Some(use_tree);
|
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);
|
self.check_import_as_underscore(use_tree, id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -332,7 +330,6 @@ impl Resolver<'_, '_> {
|
|||||||
base_use_tree: None,
|
base_use_tree: None,
|
||||||
base_id: ast::DUMMY_NODE_ID,
|
base_id: ast::DUMMY_NODE_ID,
|
||||||
item_span: DUMMY_SP,
|
item_span: DUMMY_SP,
|
||||||
base_use_is_pub: false,
|
|
||||||
};
|
};
|
||||||
visit::walk_crate(&mut visitor, krate);
|
visit::walk_crate(&mut visitor, krate);
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ use std::ops::ControlFlow;
|
|||||||
|
|
||||||
pub use self::infer_ctxt_ext::*;
|
pub use self::infer_ctxt_ext::*;
|
||||||
pub use self::type_err_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.
|
// When outputting impl candidates, prefer showing those that are more similar.
|
||||||
//
|
//
|
||||||
|
@ -41,11 +41,6 @@ use std::ops::ControlFlow;
|
|||||||
|
|
||||||
pub(crate) use self::project::{needs_normalization, BoundVarReplacer, PlaceholderReplacer};
|
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::{add_placeholder_note, orphan_check, overlapping_impls};
|
||||||
pub use self::coherence::{OrphanCheckErr, OverlapResult};
|
pub use self::coherence::{OrphanCheckErr, OverlapResult};
|
||||||
pub use self::engine::{ObligationCtxt, TraitEngineExt};
|
pub use self::engine::{ObligationCtxt, TraitEngineExt};
|
||||||
|
@ -9,7 +9,7 @@ use rustc_middle::ty::{self, ImplSubject, ToPredicate, Ty, TyCtxt, TypeVisitable
|
|||||||
use rustc_span::Span;
|
use rustc_span::Span;
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
|
|
||||||
pub use rustc_infer::traits::{self, util::*};
|
pub use rustc_infer::traits::util::*;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// `TraitAliasExpander` iterator
|
// `TraitAliasExpander` iterator
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#![doc = include_str!("../../stdarch/crates/core_arch/src/core_arch_docs.md")]
|
#![doc = include_str!("../../stdarch/crates/core_arch/src/core_arch_docs.md")]
|
||||||
|
|
||||||
|
#[allow(unused_imports)]
|
||||||
#[stable(feature = "simd_arch", since = "1.27.0")]
|
#[stable(feature = "simd_arch", since = "1.27.0")]
|
||||||
pub use crate::core_arch::arch::*;
|
pub use crate::core_arch::arch::*;
|
||||||
|
|
||||||
|
@ -120,8 +120,6 @@
|
|||||||
#![deny(unsafe_op_in_unsafe_fn)]
|
#![deny(unsafe_op_in_unsafe_fn)]
|
||||||
#![deny(fuzzy_provenance_casts)]
|
#![deny(fuzzy_provenance_casts)]
|
||||||
|
|
||||||
extern crate test;
|
|
||||||
|
|
||||||
mod alloc;
|
mod alloc;
|
||||||
mod any;
|
mod any;
|
||||||
mod array;
|
mod array;
|
||||||
|
@ -8,8 +8,6 @@ use core::num::flt2dec::{
|
|||||||
};
|
};
|
||||||
use core::num::fmt::{Formatted, Part};
|
use core::num::fmt::{Formatted, Part};
|
||||||
|
|
||||||
pub use test::Bencher;
|
|
||||||
|
|
||||||
mod estimator;
|
mod estimator;
|
||||||
mod strategy {
|
mod strategy {
|
||||||
mod dragon;
|
mod dragon;
|
||||||
|
@ -35,6 +35,5 @@ pub mod simd {
|
|||||||
pub use crate::core_simd::masks::*;
|
pub use crate::core_simd::masks::*;
|
||||||
pub use crate::core_simd::ord::*;
|
pub use crate::core_simd::ord::*;
|
||||||
pub use crate::core_simd::swizzle::*;
|
pub use crate::core_simd::swizzle::*;
|
||||||
pub use crate::core_simd::swizzle_dyn::*;
|
|
||||||
pub use crate::core_simd::vector::*;
|
pub use crate::core_simd::vector::*;
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
pub mod alloc;
|
pub mod alloc;
|
||||||
pub mod small_c_string;
|
pub mod small_c_string;
|
||||||
|
#[allow(unused_imports)]
|
||||||
pub mod thread_local;
|
pub mod thread_local;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
@ -241,6 +241,7 @@ pub unsafe fn cleanup() {
|
|||||||
|
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
pub use crate::sys::android::signal;
|
pub use crate::sys::android::signal;
|
||||||
|
#[allow(unused_imports)]
|
||||||
#[cfg(not(target_os = "android"))]
|
#[cfg(not(target_os = "android"))]
|
||||||
pub use libc::signal;
|
pub use libc::signal;
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
pub use self::process_common::{Command, CommandArgs, ExitCode, Stdio, StdioPipes};
|
pub use self::process_common::{Command, CommandArgs, ExitCode, Stdio, StdioPipes};
|
||||||
pub use self::process_inner::{ExitStatus, ExitStatusError, Process};
|
pub use self::process_inner::{ExitStatus, ExitStatusError, Process};
|
||||||
pub use crate::ffi::OsString as EnvKey;
|
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))]
|
#[cfg_attr(any(target_os = "espidf", target_os = "horizon"), allow(unused))]
|
||||||
mod process_common;
|
mod process_common;
|
||||||
|
@ -75,6 +75,7 @@ cfg_if::cfg_if! {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
#[allow(unused_imports)]
|
||||||
pub use libc::{sigemptyset, sigaddset};
|
pub use libc::{sigemptyset, sigaddset};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ mod in_fn_test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mod blurg {
|
mod blurg {
|
||||||
|
#[allow(unused_imports)]
|
||||||
pub use std::cmp::Ordering::*; // ok, re-export
|
pub use std::cmp::Ordering::*; // ok, re-export
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ mod in_fn_test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mod blurg {
|
mod blurg {
|
||||||
|
#[allow(unused_imports)]
|
||||||
pub use std::cmp::Ordering::*; // ok, re-export
|
pub use std::cmp::Ordering::*; // ok, re-export
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
#![allow(unused_imports)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod macros;
|
mod macros;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
mod generated;
|
mod generated;
|
||||||
|
|
||||||
#[allow(unreachable_pub)]
|
#[allow(unreachable_pub)]
|
||||||
pub use self::generated::{SyntaxKind, T};
|
pub use self::generated::SyntaxKind;
|
||||||
|
|
||||||
impl From<u16> for SyntaxKind {
|
impl From<u16> for SyntaxKind {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
File diff suppressed because one or more lines are too long
@ -450,7 +450,6 @@ fn generate_syntax_kinds(grammar: KindsSrc<'_>) -> String {
|
|||||||
[ident] => { $crate::SyntaxKind::IDENT };
|
[ident] => { $crate::SyntaxKind::IDENT };
|
||||||
[shebang] => { $crate::SyntaxKind::SHEBANG };
|
[shebang] => { $crate::SyntaxKind::SHEBANG };
|
||||||
}
|
}
|
||||||
pub use T;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
sourcegen::add_preamble("sourcegen_ast", sourcegen::reformat(ast.to_string()))
|
sourcegen::add_preamble("sourcegen_ast", sourcegen::reformat(ast.to_string()))
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![allow(unused_imports)]
|
||||||
|
|
||||||
use std::collections::{hash_set, HashSet};
|
use std::collections::{hash_set, HashSet};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
25
tests/ui/imports/pub-reexport-empty.rs
Normal file
25
tests/ui/imports/pub-reexport-empty.rs
Normal file
@ -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
tests/ui/imports/pub-reexport-empty.stderr
Normal file
20
tests/ui/imports/pub-reexport-empty.stderr
Normal file
@ -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,9 +5,12 @@ mod a {
|
|||||||
mod foo {}
|
mod foo {}
|
||||||
|
|
||||||
mod a {
|
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::*;
|
pub use super::*;
|
||||||
//~^ WARNING glob import doesn't reexport anything because no candidate is public enough
|
//~^ WARNING glob import doesn't reexport anything because no candidate is public enough
|
||||||
|
//~| WARNING unused import: `super::*`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,44 +11,44 @@ LL | pub use super::foo;
|
|||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0603]: module import `foo` is private
|
error[E0603]: module import `foo` is private
|
||||||
--> $DIR/reexports.rs:33:15
|
--> $DIR/reexports.rs:36:15
|
||||||
|
|
|
|
||||||
LL | use b::a::foo::S;
|
LL | use b::a::foo::S;
|
||||||
| ^^^ private module import
|
| ^^^ private module import
|
||||||
|
|
|
|
||||||
note: the module import `foo` is defined here...
|
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.
|
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
|
note: ...and refers to the module `foo` which is defined here
|
||||||
--> $DIR/reexports.rs:16:5
|
--> $DIR/reexports.rs:19:5
|
||||||
|
|
|
|
||||||
LL | mod foo {
|
LL | mod foo {
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
||||||
error[E0603]: module import `foo` is private
|
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;
|
LL | use b::b::foo::S as T;
|
||||||
| ^^^ private module import
|
| ^^^ private module import
|
||||||
|
|
|
|
||||||
note: the module import `foo` is defined here...
|
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.
|
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
|
note: ...and refers to the module `foo` which is defined here
|
||||||
--> $DIR/reexports.rs:16:5
|
--> $DIR/reexports.rs:19:5
|
||||||
|
|
|
|
||||||
LL | mod foo {
|
LL | mod foo {
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
||||||
warning: glob import doesn't reexport anything because no candidate is public enough
|
warning: unused import: `super::foo`
|
||||||
--> $DIR/reexports.rs:9:17
|
--> $DIR/reexports.rs:8:17
|
||||||
|
|
|
|
||||||
LL | pub use super::*;
|
LL | pub use super::foo;
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/reexports.rs:1:9
|
--> $DIR/reexports.rs:1:9
|
||||||
@ -56,7 +56,19 @@ note: the lint level is defined here
|
|||||||
LL | #![warn(unused_imports)]
|
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.
|
Some errors have detailed explanations: E0364, E0603.
|
||||||
For more information about an error, try `rustc --explain E0364`.
|
For more information about an error, try `rustc --explain E0364`.
|
||||||
|
@ -42,7 +42,7 @@ mod foo {
|
|||||||
pub struct Square{pub p: Point, pub h: usize, pub w: usize}
|
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
|
// Don't ignore on 'pub use' because we're not sure if it's used or not
|
||||||
pub use std::cmp::PartialEq;
|
pub use std::cmp::PartialEq;
|
||||||
pub struct Square;
|
pub struct Square;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// run-rustfix
|
// run-rustfix
|
||||||
|
|
||||||
#![allow(unused_variables, dead_code)]
|
#![allow(unused_variables, dead_code, unused_imports)]
|
||||||
|
|
||||||
fn for_struct() {
|
fn for_struct() {
|
||||||
let foo = 3; //~ ERROR expected `;`, found keyword `struct`
|
let foo = 3; //~ ERROR expected `;`, found keyword `struct`
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// run-rustfix
|
// run-rustfix
|
||||||
|
|
||||||
#![allow(unused_variables, dead_code)]
|
#![allow(unused_variables, dead_code, unused_imports)]
|
||||||
|
|
||||||
fn for_struct() {
|
fn for_struct() {
|
||||||
let foo = 3 //~ ERROR expected `;`, found keyword `struct`
|
let foo = 3 //~ ERROR expected `;`, found keyword `struct`
|
||||||
|
@ -2,13 +2,17 @@
|
|||||||
mod rank {
|
mod rank {
|
||||||
pub use self::Professor::*;
|
pub use self::Professor::*;
|
||||||
//~^ ERROR glob import doesn't reexport anything
|
//~^ ERROR glob import doesn't reexport anything
|
||||||
|
//~| ERROR unused import: `self::Professor::*`
|
||||||
pub use self::Lieutenant::{JuniorGrade, Full};
|
pub use self::Lieutenant::{JuniorGrade, Full};
|
||||||
//~^ ERROR `JuniorGrade` is private, and cannot be re-exported
|
//~^ ERROR `JuniorGrade` is private, and cannot be re-exported
|
||||||
//~| ERROR `Full` is private, and cannot be re-exported
|
//~| ERROR `Full` is private, and cannot be re-exported
|
||||||
|
//~| ERROR unused imports: `Full`, `JuniorGrade`
|
||||||
pub use self::PettyOfficer::*;
|
pub use self::PettyOfficer::*;
|
||||||
//~^ ERROR glob import doesn't reexport anything
|
//~^ ERROR glob import doesn't reexport anything
|
||||||
|
//~| ERROR unused import: `self::PettyOfficer::*`
|
||||||
pub use self::Crewman::*;
|
pub use self::Crewman::*;
|
||||||
//~^ ERROR glob import doesn't reexport anything
|
//~^ ERROR glob import doesn't reexport anything
|
||||||
|
//~| ERROR unused import: `self::Crewman::*`
|
||||||
|
|
||||||
enum Professor {
|
enum Professor {
|
||||||
Adjunct,
|
Adjunct,
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
error[E0364]: `JuniorGrade` is private, and cannot be re-exported
|
error[E0364]: `JuniorGrade` is private, and cannot be re-exported
|
||||||
--> $DIR/issue-46209-private-enum-variant-reexport.rs:5:32
|
--> $DIR/issue-46209-private-enum-variant-reexport.rs:6:32
|
||||||
|
|
|
|
||||||
LL | pub use self::Lieutenant::{JuniorGrade, Full};
|
LL | pub use self::Lieutenant::{JuniorGrade, Full};
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: consider marking `JuniorGrade` as `pub` in the imported module
|
note: consider marking `JuniorGrade` as `pub` in the imported module
|
||||||
--> $DIR/issue-46209-private-enum-variant-reexport.rs:5:32
|
--> $DIR/issue-46209-private-enum-variant-reexport.rs:6:32
|
||||||
|
|
|
|
||||||
LL | pub use self::Lieutenant::{JuniorGrade, Full};
|
LL | pub use self::Lieutenant::{JuniorGrade, Full};
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0364]: `Full` is private, and cannot be re-exported
|
error[E0364]: `Full` is private, and cannot be re-exported
|
||||||
--> $DIR/issue-46209-private-enum-variant-reexport.rs:5:45
|
--> $DIR/issue-46209-private-enum-variant-reexport.rs:6:45
|
||||||
|
|
|
|
||||||
LL | pub use self::Lieutenant::{JuniorGrade, Full};
|
LL | pub use self::Lieutenant::{JuniorGrade, Full};
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
|
|
|
||||||
note: consider marking `Full` as `pub` in the imported module
|
note: consider marking `Full` as `pub` in the imported module
|
||||||
--> $DIR/issue-46209-private-enum-variant-reexport.rs:5:45
|
--> $DIR/issue-46209-private-enum-variant-reexport.rs:6:45
|
||||||
|
|
|
|
||||||
LL | pub use self::Lieutenant::{JuniorGrade, Full};
|
LL | pub use self::Lieutenant::{JuniorGrade, Full};
|
||||||
| ^^^^
|
| ^^^^
|
||||||
@ -34,18 +34,42 @@ note: the lint level is defined here
|
|||||||
LL | #[deny(unused_imports)]
|
LL | #[deny(unused_imports)]
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: unused import: `self::Professor::*`
|
||||||
|
--> $DIR/issue-46209-private-enum-variant-reexport.rs:3:13
|
||||||
|
|
|
||||||
|
LL | pub use self::Professor::*;
|
||||||
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: unused imports: `Full`, `JuniorGrade`
|
||||||
|
--> $DIR/issue-46209-private-enum-variant-reexport.rs:6:32
|
||||||
|
|
|
||||||
|
LL | pub use self::Lieutenant::{JuniorGrade, Full};
|
||||||
|
| ^^^^^^^^^^^ ^^^^
|
||||||
|
|
||||||
error: glob import doesn't reexport anything because no candidate is public enough
|
error: glob import doesn't reexport anything because no candidate is public enough
|
||||||
--> $DIR/issue-46209-private-enum-variant-reexport.rs:8:13
|
--> $DIR/issue-46209-private-enum-variant-reexport.rs:10:13
|
||||||
|
|
|
||||||
|
LL | pub use self::PettyOfficer::*;
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: unused import: `self::PettyOfficer::*`
|
||||||
|
--> $DIR/issue-46209-private-enum-variant-reexport.rs:10:13
|
||||||
|
|
|
|
||||||
LL | pub use self::PettyOfficer::*;
|
LL | pub use self::PettyOfficer::*;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: glob import doesn't reexport anything because no candidate is public enough
|
error: glob import doesn't reexport anything because no candidate is public enough
|
||||||
--> $DIR/issue-46209-private-enum-variant-reexport.rs:10:13
|
--> $DIR/issue-46209-private-enum-variant-reexport.rs:13:13
|
||||||
|
|
|
|
||||||
LL | pub use self::Crewman::*;
|
LL | pub use self::Crewman::*;
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
error: unused import: `self::Crewman::*`
|
||||||
|
--> $DIR/issue-46209-private-enum-variant-reexport.rs:13:13
|
||||||
|
|
|
||||||
|
LL | pub use self::Crewman::*;
|
||||||
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 9 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0364`.
|
For more information about this error, try `rustc --explain E0364`.
|
||||||
|
@ -12,7 +12,9 @@ mod m3 {
|
|||||||
|
|
||||||
#[deny(unused_imports)]
|
#[deny(unused_imports)]
|
||||||
mod m4 {
|
mod m4 {
|
||||||
pub use ::E::*; //~ ERROR glob import doesn't reexport anything
|
pub use ::E::*;
|
||||||
|
//~^ ERROR glob import doesn't reexport anything
|
||||||
|
//~| ERROR unused import: `::E::*`
|
||||||
}
|
}
|
||||||
|
|
||||||
enum E { V }
|
enum E { V }
|
||||||
|
@ -42,7 +42,13 @@ note: the lint level is defined here
|
|||||||
LL | #[deny(unused_imports)]
|
LL | #[deny(unused_imports)]
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: unused import: `::E::*`
|
||||||
|
--> $DIR/private-variant-reexport.rs:15:13
|
||||||
|
|
|
||||||
|
LL | pub use ::E::*;
|
||||||
|
| ^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 5 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0364, E0365.
|
Some errors have detailed explanations: E0364, E0365.
|
||||||
For more information about an error, try `rustc --explain E0364`.
|
For more information about an error, try `rustc --explain E0364`.
|
||||||
|
Loading…
Reference in New Issue
Block a user