Skip to content

Commit

Permalink
remove redundant imports
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
surechen committed Dec 10, 2023
1 parent 8b9931e commit 98b208a
Show file tree
Hide file tree
Showing 14 changed files with 5 additions and 18 deletions.
3 changes: 1 addition & 2 deletions src/borrow_tracker/stacked_borrows/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ use smallvec::SmallVec;
use std::fmt;

use rustc_data_structures::fx::FxHashSet;
use rustc_middle::mir::interpret::{alloc_range, AllocId, AllocRange, InterpError};
use rustc_span::{Span, SpanData};
use rustc_target::abi::Size;

use crate::borrow_tracker::{
stacked_borrows::Permission, AccessKind, GlobalStateInner, ProtectorKind,
AccessKind, GlobalStateInner, ProtectorKind,
};
use crate::*;

Expand Down
3 changes: 1 addition & 2 deletions src/borrow_tracker/stacked_borrows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ use rustc_target::abi::{Abi, Size};

use crate::borrow_tracker::{
stacked_borrows::diagnostics::{AllocHistory, DiagnosticCx, DiagnosticCxBuilder},
AccessKind, GlobalStateInner, ProtectorKind, RetagFields,
};
AccessKind, GlobalStateInner, ProtectorKind,};
use crate::*;

use diagnostics::{RetagCause, RetagInfo};
Expand Down
2 changes: 1 addition & 1 deletion src/borrow_tracker/tree_borrows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use log::trace;
use rustc_target::abi::{Abi, Size};

use crate::borrow_tracker::{
AccessKind, GlobalState, GlobalStateInner, ProtectorKind, RetagFields,
AccessKind, GlobalState, GlobalStateInner, ProtectorKind,
};
use rustc_middle::{
mir::{Mutability, RetagKind},
Expand Down
1 change: 0 additions & 1 deletion src/borrow_tracker/tree_borrows/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use std::fmt;

use smallvec::SmallVec;

use rustc_const_eval::interpret::InterpResult;
use rustc_data_structures::fx::FxHashSet;
use rustc_span::Span;
use rustc_target::abi::Size;
Expand Down
1 change: 0 additions & 1 deletion src/concurrency/weak_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ use std::{
collections::VecDeque,
};

use rustc_const_eval::interpret::{alloc_range, AllocRange, InterpResult, MPlaceTy, Scalar};
use rustc_data_structures::fx::FxHashMap;

use crate::*;
Expand Down
1 change: 0 additions & 1 deletion src/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use std::thread;
use log::info;
use rustc_middle::ty::Ty;

use crate::borrow_tracker::RetagFields;
use crate::concurrency::thread::TlsAllocAction;
use crate::diagnostics::report_leaks;
use rustc_data_structures::fx::FxHashSet;
Expand Down
1 change: 0 additions & 1 deletion src/shims/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::ffi::{OsStr, OsString};
use std::io::ErrorKind;
use std::mem;

use rustc_const_eval::interpret::Pointer;
use rustc_data_structures::fx::FxHashMap;
use rustc_middle::ty::layout::LayoutOf;
use rustc_middle::ty::Ty;
Expand Down
1 change: 0 additions & 1 deletion src/shims/unix/fs.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::any::Any;
use std::borrow::Cow;
use std::collections::BTreeMap;
use std::convert::TryInto;
use std::fs::{
read_dir, remove_dir, remove_file, rename, DirBuilder, File, FileType, OpenOptions, ReadDir,
};
Expand Down
2 changes: 1 addition & 1 deletion src/shims/unix/linux/sync.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::time::SystemTime;

use crate::concurrency::thread::{MachineCallback, Time};
use crate::concurrency::thread::MachineCallback;
use crate::*;

/// Implementation of the SYS_futex syscall.
Expand Down
2 changes: 1 addition & 1 deletion src/shims/unix/sync.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::time::SystemTime;

use crate::concurrency::sync::CondvarLock;
use crate::concurrency::thread::{MachineCallback, Time};
use crate::concurrency::thread::MachineCallback;
use crate::*;

// pthread_mutexattr_t is either 4 or 8 bytes, depending on the platform.
Expand Down
1 change: 0 additions & 1 deletion tests/pass-dep/shims/libc-fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#![feature(io_error_more)]
#![feature(io_error_uncategorized)]

use std::convert::TryInto;
use std::ffi::CString;
use std::fs::{canonicalize, remove_dir_all, remove_file, File};
use std::io::{Error, ErrorKind, Write};
Expand Down
2 changes: 0 additions & 2 deletions tests/pass/arrays.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::convert::TryFrom;

fn empty_array() -> [u16; 0] {
[]
}
Expand Down
1 change: 0 additions & 1 deletion tests/pass/binary-heap.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::collections::BinaryHeap;
use std::iter::Iterator;

fn zero_sized_push() {
const N: usize = 8;
Expand Down
2 changes: 0 additions & 2 deletions tests/pass/enum-nullable-const-null-with-fields.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::result::Result;
use std::result::Result::Ok;

static C: Result<(), Box<isize>> = Ok(());

Expand Down

0 comments on commit 98b208a

Please sign in to comment.