From e6376631cc1c8c63a1600a3e1bc76158e0885fd5 Mon Sep 17 00:00:00 2001 From: surechen Date: Fri, 10 Nov 2023 10:11:24 +0800 Subject: [PATCH] remove redundant imports detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR. --- src/abi/comments.rs | 1 - src/abi/mod.rs | 2 +- src/analyze.rs | 1 - src/constant.rs | 3 +-- src/inline_asm.rs | 1 - src/intrinsics/llvm.rs | 2 -- src/intrinsics/llvm_aarch64.rs | 2 -- src/intrinsics/llvm_x86.rs | 1 - src/intrinsics/simd.rs | 2 -- 9 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/abi/comments.rs b/src/abi/comments.rs index ade6968de2b..a318cae1722 100644 --- a/src/abi/comments.rs +++ b/src/abi/comments.rs @@ -3,7 +3,6 @@ use std::borrow::Cow; -use rustc_middle::mir; use rustc_target::abi::call::PassMode; use crate::prelude::*; diff --git a/src/abi/mod.rs b/src/abi/mod.rs index 0ff1473da43..2c194f6d6d3 100644 --- a/src/abi/mod.rs +++ b/src/abi/mod.rs @@ -6,7 +6,7 @@ use std::borrow::Cow; -use cranelift_codegen::ir::{AbiParam, SigRef}; +use cranelift_codegen::ir::SigRef; use cranelift_module::ModuleError; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc_middle::ty::layout::FnAbiOf; diff --git a/src/analyze.rs b/src/analyze.rs index 321612238ea..c5762638a6b 100644 --- a/src/analyze.rs +++ b/src/analyze.rs @@ -2,7 +2,6 @@ use rustc_index::IndexVec; use rustc_middle::mir::StatementKind::*; -use rustc_middle::ty::Ty; use crate::prelude::*; diff --git a/src/constant.rs b/src/constant.rs index 65f7ee6999a..9ffa006e59b 100644 --- a/src/constant.rs +++ b/src/constant.rs @@ -3,10 +3,9 @@ use std::cmp::Ordering; use cranelift_module::*; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::fx::FxHashSet; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc_middle::mir::interpret::{read_target_uint, AllocId, GlobalAlloc, Scalar}; -use rustc_middle::mir::ConstValue; use rustc_middle::ty::ScalarInt; use crate::prelude::*; diff --git a/src/inline_asm.rs b/src/inline_asm.rs index 25d14319f57..73f4bc7c151 100644 --- a/src/inline_asm.rs +++ b/src/inline_asm.rs @@ -3,7 +3,6 @@ use std::fmt::Write; use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece}; -use rustc_middle::mir::InlineAsmOperand; use rustc_span::sym; use rustc_target::asm::*; use target_lexicon::BinaryFormat; diff --git a/src/intrinsics/llvm.rs b/src/intrinsics/llvm.rs index 659e6c133ef..dbd5db87511 100644 --- a/src/intrinsics/llvm.rs +++ b/src/intrinsics/llvm.rs @@ -1,7 +1,5 @@ //! Emulate LLVM intrinsics -use rustc_middle::ty::GenericArgsRef; - use crate::intrinsics::*; use crate::prelude::*; diff --git a/src/intrinsics/llvm_aarch64.rs b/src/intrinsics/llvm_aarch64.rs index ee098be1fce..e1e514dca44 100644 --- a/src/intrinsics/llvm_aarch64.rs +++ b/src/intrinsics/llvm_aarch64.rs @@ -1,7 +1,5 @@ //! Emulate AArch64 LLVM intrinsics -use rustc_middle::ty::GenericArgsRef; - use crate::intrinsics::*; use crate::prelude::*; diff --git a/src/intrinsics/llvm_x86.rs b/src/intrinsics/llvm_x86.rs index 07b95b7933d..99bb5c4eae2 100644 --- a/src/intrinsics/llvm_x86.rs +++ b/src/intrinsics/llvm_x86.rs @@ -1,7 +1,6 @@ //! Emulate x86 LLVM intrinsics use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece}; -use rustc_middle::ty::GenericArgsRef; use rustc_target::asm::*; use crate::inline_asm::{codegen_inline_asm_inner, CInlineAsmOperand}; diff --git a/src/intrinsics/simd.rs b/src/intrinsics/simd.rs index 5997e6026b4..fe4f073f799 100644 --- a/src/intrinsics/simd.rs +++ b/src/intrinsics/simd.rs @@ -1,8 +1,6 @@ //! Codegen `extern "platform-intrinsic"` intrinsics. use cranelift_codegen::ir::immediates::Offset32; -use rustc_middle::ty::GenericArgsRef; -use rustc_span::Symbol; use rustc_target::abi::Endian; use super::*;