diff --git a/src/comment.rs b/src/comment.rs index 7da0f79bd09..f7cd7cefb3d 100644 --- a/src/comment.rs +++ b/src/comment.rs @@ -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() { diff --git a/src/config/file_lines.rs b/src/config/file_lines.rs index e33fe9bb283..224864393d3 100644 --- a/src/config/file_lines.rs +++ b/src/config/file_lines.rs @@ -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; diff --git a/src/config/mod.rs b/src/config/mod.rs index 7538b26522d..9d454137b2c 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -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] diff --git a/src/emitter/checkstyle.rs b/src/emitter/checkstyle.rs index 56d6a0ed681..2a4a9dfce8e 100644 --- a/src/emitter/checkstyle.rs +++ b/src/emitter/checkstyle.rs @@ -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; diff --git a/src/emitter/diff.rs b/src/emitter/diff.rs index 764cd136e01..0af19a7d0b2 100644 --- a/src/emitter/diff.rs +++ b/src/emitter/diff.rs @@ -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] diff --git a/src/emitter/json.rs b/src/emitter/json.rs index 5594196bed9..f47c3260a02 100644 --- a/src/emitter/json.rs +++ b/src/emitter/json.rs @@ -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] diff --git a/src/emitter/modified_lines.rs b/src/emitter/modified_lines.rs index 94ff570a8a9..81f0a31b974 100644 --- a/src/emitter/modified_lines.rs +++ b/src/emitter/modified_lines.rs @@ -1,6 +1,5 @@ use super::*; use crate::rustfmt_diff::{make_diff, ModifiedLines}; -use std::io::Write; #[derive(Debug, Default)] pub(crate) struct ModifiedLinesEmitter; diff --git a/src/emitter/stdout.rs b/src/emitter/stdout.rs index 0bbc7332dfe..0b635a28bf2 100644 --- a/src/emitter/stdout.rs +++ b/src/emitter/stdout.rs @@ -1,6 +1,5 @@ use super::*; use crate::config::Verbosity; -use std::io::Write; #[derive(Debug)] pub(crate) struct StdoutEmitter { diff --git a/src/ignore_path.rs b/src/ignore_path.rs index d955949496a..7b5697bec3e 100644 --- a/src/ignore_path.rs +++ b/src/ignore_path.rs @@ -1,4 +1,4 @@ -use ignore::{self, gitignore}; +use ignore::gitignore; use crate::config::{FileName, IgnoreList}; diff --git a/src/imports.rs b/src/imports.rs index f8e7fa62890..09f6e752338 100644 --- a/src/imports.rs +++ b/src/imports.rs @@ -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. diff --git a/src/reorder.rs b/src/reorder.rs index 3bddf4c1b6a..3e14f9f1272 100644 --- a/src/reorder.rs +++ b/src/reorder.rs @@ -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}; diff --git a/src/types.rs b/src/types.rs index 8ca27150371..a5a4244903c 100644 --- a/src/types.rs +++ b/src/types.rs @@ -1,4 +1,3 @@ -use std::iter::ExactSizeIterator; use std::ops::Deref; use rustc_ast::ast::{self, FnRetTy, Mutability, Term};