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.
This commit is contained in:
parent
9c809ce8de
commit
1b9bf8adf3
@ -1,6 +1,6 @@
|
||||
// Formatting and tools for comments.
|
||||
|
||||
use std::{self, borrow::Cow, iter};
|
||||
use std::{borrow::Cow, iter};
|
||||
|
||||
use itertools::{multipeek, MultiPeek};
|
||||
use lazy_static::lazy_static;
|
||||
@ -1847,7 +1847,6 @@ fn remove_comment_header(comment: &str) -> &str {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::shape::{Indent, Shape};
|
||||
|
||||
#[test]
|
||||
fn char_classes() {
|
||||
|
@ -6,7 +6,7 @@
|
||||
use std::{cmp, fmt, iter, str};
|
||||
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_span::{self, SourceFile};
|
||||
use rustc_span::SourceFile;
|
||||
use serde::{ser, Deserialize, Deserializer, Serialize, Serializer};
|
||||
use serde_json as json;
|
||||
use thiserror::Error;
|
||||
|
@ -1,5 +1,4 @@
|
||||
use std::cell::Cell;
|
||||
use std::default::Default;
|
||||
use std::fs::File;
|
||||
use std::io::{Error, ErrorKind, Read};
|
||||
use std::path::{Path, PathBuf};
|
||||
@ -1017,7 +1016,6 @@ fn test_override_single_line_if_else_max_width_exceeds_max_width() {
|
||||
#[cfg(test)]
|
||||
mod partially_unstable_option {
|
||||
use super::mock::{Config, PartiallyUnstableOption};
|
||||
use super::*;
|
||||
|
||||
/// From the command line, we can override with a stable variant.
|
||||
#[test]
|
||||
|
@ -1,7 +1,6 @@
|
||||
use self::xml::XmlEscaped;
|
||||
use super::*;
|
||||
use crate::rustfmt_diff::{make_diff, DiffLine, Mismatch};
|
||||
use std::io::{self, Write};
|
||||
|
||||
mod xml;
|
||||
|
||||
|
@ -51,8 +51,6 @@ fn emit_formatted_file(
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::config::Config;
|
||||
use crate::FileName;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[test]
|
||||
|
@ -2,7 +2,6 @@
|
||||
use crate::rustfmt_diff::{make_diff, DiffLine, Mismatch};
|
||||
use serde::Serialize;
|
||||
use serde_json::to_string as to_json_string;
|
||||
use std::io::{self, Write};
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub(crate) struct JsonEmitter {
|
||||
@ -106,7 +105,6 @@ fn add_misformatted_file(
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::FileName;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[test]
|
||||
|
@ -1,6 +1,5 @@
|
||||
use super::*;
|
||||
use crate::rustfmt_diff::{make_diff, ModifiedLines};
|
||||
use std::io::Write;
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub(crate) struct ModifiedLinesEmitter;
|
||||
|
@ -1,6 +1,5 @@
|
||||
use super::*;
|
||||
use crate::config::Verbosity;
|
||||
use std::io::Write;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct StdoutEmitter {
|
||||
|
@ -1,4 +1,4 @@
|
||||
use ignore::{self, gitignore};
|
||||
use ignore::gitignore;
|
||||
|
||||
use crate::config::{FileName, IgnoreList};
|
||||
|
||||
|
@ -1102,7 +1102,6 @@ enum SharedPrefix {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use rustc_span::DUMMY_SP;
|
||||
|
||||
// Parse the path part of an import. This parser is not robust and is only
|
||||
// suitable for use in a test harness.
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
// FIXME(#2455): Reorder trait items.
|
||||
|
||||
use std::cmp::{Ord, Ordering};
|
||||
use std::cmp::Ordering;
|
||||
|
||||
use rustc_ast::{ast, attr};
|
||||
use rustc_span::{symbol::sym, Span};
|
||||
|
@ -1,4 +1,3 @@
|
||||
use std::iter::ExactSizeIterator;
|
||||
use std::ops::Deref;
|
||||
|
||||
use rustc_ast::ast::{self, FnRetTy, Mutability, Term};
|
||||
|
Loading…
Reference in New Issue
Block a user