diff options
| author | bors <bors@rust-lang.org> | 2024-07-29 02:43:41 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-07-29 02:43:41 +0000 |
| commit | 2e630267b2bce50af3258ce4817e377fa09c145b (patch) | |
| tree | 29006db815bf547dfd0129910b23b8c54675bd98 /src/tools/compiletest | |
| parent | 2cbbe8b8bb2be672b14cf741a2f0ec24a49f3f0b (diff) | |
| parent | 84ac80f1921afc243d71fd0caaa4f2838c294102 (diff) | |
Auto merge of #125443 - nnethercote:rustfmt-use-decls, r=lcnr,cuviper,GuillaumeGomez
rustfmt `use` declarations This PR implements https://github.com/rust-lang/compiler-team/issues/750, which changes how `use` declarations are formatted by adding these options to `rustfmt.toml`: ``` group_imports = "StdExternalCrate" imports_granularity = "Module" ``` r? `@ghost`
Diffstat (limited to 'src/tools/compiletest')
| -rw-r--r-- | src/tools/compiletest/src/common.rs | 11 | ||||
| -rw-r--r-- | src/tools/compiletest/src/errors.rs | 4 | ||||
| -rw-r--r-- | src/tools/compiletest/src/header.rs | 3 | ||||
| -rw-r--r-- | src/tools/compiletest/src/header/cfg.rs | 3 | ||||
| -rw-r--r-- | src/tools/compiletest/src/header/tests.rs | 3 | ||||
| -rw-r--r-- | src/tools/compiletest/src/json.rs | 8 | ||||
| -rw-r--r-- | src/tools/compiletest/src/lib.rs | 16 | ||||
| -rw-r--r-- | src/tools/compiletest/src/main.rs | 7 | ||||
| -rw-r--r-- | src/tools/compiletest/src/raise_fd_limit.rs | 3 | ||||
| -rw-r--r-- | src/tools/compiletest/src/read2.rs | 9 | ||||
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 44 | ||||
| -rw-r--r-- | src/tools/compiletest/src/runtest/debugger.rs | 8 | ||||
| -rw-r--r-- | src/tools/compiletest/src/util.rs | 3 |
13 files changed, 59 insertions, 63 deletions
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index bc66dcbfb94..70ebefe3f41 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -1,19 +1,18 @@ -pub use self::Mode::*; - +use std::collections::{HashMap, HashSet}; use std::ffi::OsString; -use std::fmt; -use std::iter; use std::path::{Path, PathBuf}; use std::process::Command; use std::str::FromStr; use std::sync::OnceLock; +use std::{fmt, iter}; -use crate::util::{add_dylib_path, PathBufExt}; use build_helper::git::GitConfig; use serde::de::{Deserialize, Deserializer, Error as _}; -use std::collections::{HashMap, HashSet}; use test::{ColorConfig, OutputFormat}; +pub use self::Mode::*; +use crate::util::{add_dylib_path, PathBufExt}; + macro_rules! string_enum { ($(#[$meta:meta])* $vis:vis enum $name:ident { $($variant:ident => $repr:expr,)* }) => { $(#[$meta])* diff --git a/src/tools/compiletest/src/errors.rs b/src/tools/compiletest/src/errors.rs index 7a5abc51d04..4ca9f02ddc7 100644 --- a/src/tools/compiletest/src/errors.rs +++ b/src/tools/compiletest/src/errors.rs @@ -1,5 +1,3 @@ -use self::WhichLine::*; - use std::fmt; use std::fs::File; use std::io::prelude::*; @@ -11,6 +9,8 @@ use std::sync::OnceLock; use regex::Regex; use tracing::*; +use self::WhichLine::*; + #[derive(Copy, Clone, Debug, PartialEq)] pub enum ErrorKind { Help, diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 3afb5e27547..0208ed34ac1 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -11,8 +11,7 @@ use regex::Regex; use tracing::*; use crate::common::{Config, Debugger, FailMode, Mode, PassMode}; -use crate::header::cfg::parse_cfg_name_directive; -use crate::header::cfg::MatchOutcome; +use crate::header::cfg::{parse_cfg_name_directive, MatchOutcome}; use crate::header::needs::CachedNeedsConditions; use crate::util::static_regex; use crate::{extract_cdb_version, extract_gdb_version}; diff --git a/src/tools/compiletest/src/header/cfg.rs b/src/tools/compiletest/src/header/cfg.rs index 522c52b1de2..948568e63c2 100644 --- a/src/tools/compiletest/src/header/cfg.rs +++ b/src/tools/compiletest/src/header/cfg.rs @@ -1,6 +1,7 @@ +use std::collections::HashSet; + use crate::common::{CompareMode, Config, Debugger, Mode}; use crate::header::IgnoreDecision; -use std::collections::HashSet; const EXTRA_ARCHS: &[&str] = &["spirv"]; diff --git a/src/tools/compiletest/src/header/tests.rs b/src/tools/compiletest/src/header/tests.rs index c790eb18d67..29e11e77f1c 100644 --- a/src/tools/compiletest/src/header/tests.rs +++ b/src/tools/compiletest/src/header/tests.rs @@ -2,11 +2,10 @@ use std::io::Read; use std::path::Path; use std::str::FromStr; +use super::iter_header; use crate::common::{Config, Debugger, Mode}; use crate::header::{parse_normalize_rule, EarlyProps, HeadersCache}; -use super::iter_header; - fn make_test_description<R: Read>( config: &Config, name: test::TestName, diff --git a/src/tools/compiletest/src/json.rs b/src/tools/compiletest/src/json.rs index 29e8809e5bd..76b83f02b14 100644 --- a/src/tools/compiletest/src/json.rs +++ b/src/tools/compiletest/src/json.rs @@ -1,12 +1,14 @@ //! These structs are a subset of the ones found in `rustc_errors::json`. //! They are only used for deserialization of JSON output provided by libtest. -use crate::errors::{Error, ErrorKind}; -use crate::runtest::ProcRes; -use serde::Deserialize; use std::path::{Path, PathBuf}; use std::str::FromStr; +use serde::Deserialize; + +use crate::errors::{Error, ErrorKind}; +use crate::runtest::ProcRes; + #[derive(Deserialize)] struct Diagnostic { message: String, diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs index 81a5acb5cf2..6acf46f9196 100644 --- a/src/tools/compiletest/src/lib.rs +++ b/src/tools/compiletest/src/lib.rs @@ -18,27 +18,29 @@ mod read2; pub mod runtest; pub mod util; -use crate::common::{expected_output_path, output_base_dir, output_relative_path, UI_EXTENSIONS}; -use crate::common::{Config, Debugger, Mode, PassMode, TestPaths}; -use crate::util::logv; -use build_helper::git::{get_git_modified_files, get_git_untracked_files}; use core::panic; -use getopts::Options; use std::collections::HashSet; use std::ffi::{OsStr, OsString}; -use std::fs; use std::io::{self, ErrorKind}; use std::path::{Path, PathBuf}; use std::process::{Command, Stdio}; use std::sync::{Arc, OnceLock}; use std::time::SystemTime; -use std::{env, vec}; +use std::{env, fs, vec}; + +use build_helper::git::{get_git_modified_files, get_git_untracked_files}; +use getopts::Options; use test::ColorConfig; use tracing::*; use walkdir::WalkDir; use self::header::{make_test_description, EarlyProps}; +use crate::common::{ + expected_output_path, output_base_dir, output_relative_path, Config, Debugger, Mode, PassMode, + TestPaths, UI_EXTENSIONS, +}; use crate::header::HeadersCache; +use crate::util::logv; pub fn parse_config(args: Vec<String>) -> Config { let mut opts = Options::new(); diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 1ec3f0a0552..7b85e6f80b3 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -1,6 +1,9 @@ -use std::{env, io::IsTerminal, sync::Arc}; +use std::env; +use std::io::IsTerminal; +use std::sync::Arc; -use compiletest::{common::Mode, log_config, parse_config, run_tests}; +use compiletest::common::Mode; +use compiletest::{log_config, parse_config, run_tests}; fn main() { tracing_subscriber::fmt::init(); diff --git a/src/tools/compiletest/src/raise_fd_limit.rs b/src/tools/compiletest/src/raise_fd_limit.rs index 218bea68a21..4445ecb7ce8 100644 --- a/src/tools/compiletest/src/raise_fd_limit.rs +++ b/src/tools/compiletest/src/raise_fd_limit.rs @@ -7,10 +7,9 @@ #[cfg(target_vendor = "apple")] #[allow(non_camel_case_types)] pub unsafe fn raise_fd_limit() { - use std::cmp; - use std::io; use std::mem::size_of_val; use std::ptr::null_mut; + use std::{cmp, io}; static CTL_KERN: libc::c_int = 1; static KERN_MAXFILESPERPROC: libc::c_int = 29; diff --git a/src/tools/compiletest/src/read2.rs b/src/tools/compiletest/src/read2.rs index 8c06339f3c3..b2d068e78b4 100644 --- a/src/tools/compiletest/src/read2.rs +++ b/src/tools/compiletest/src/read2.rs @@ -4,10 +4,11 @@ #[cfg(test)] mod tests; -pub use self::imp::read2; use std::io::{self, Write}; use std::process::{Child, Output}; +pub use self::imp::read2; + #[derive(Copy, Clone, Debug)] pub enum Truncated { Yes, @@ -154,11 +155,10 @@ mod imp { #[cfg(unix)] mod imp { - use std::io; use std::io::prelude::*; - use std::mem; use std::os::unix::prelude::*; use std::process::{ChildStderr, ChildStdout}; + use std::{io, mem}; pub fn read2( mut out_pipe: ChildStdout, @@ -228,10 +228,9 @@ mod imp { #[cfg(windows)] mod imp { - use std::io; use std::os::windows::prelude::*; use std::process::{ChildStderr, ChildStdout}; - use std::slice; + use std::{io, slice}; use miow::iocp::{CompletionPort, CompletionStatus}; use miow::pipe::NamedPipe; diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 78c06551ff2..f6e8fdd6244 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1,45 +1,37 @@ // ignore-tidy-filelength -use crate::common::{ - expected_output_path, UI_EXTENSIONS, UI_FIXED, UI_STDERR, UI_STDOUT, UI_SVG, UI_WINDOWS_SVG, -}; -use crate::common::{incremental_dir, output_base_dir, output_base_name, output_testname_unique}; -use crate::common::{Assembly, Crashes, Incremental, JsDocTest, MirOpt, RunMake, RustdocJson, Ui}; -use crate::common::{Codegen, CodegenUnits, DebugInfo, Debugger, Rustdoc}; -use crate::common::{CompareMode, FailMode, PassMode}; -use crate::common::{Config, TestPaths}; -use crate::common::{CoverageMap, CoverageRun, Pretty, RunPassValgrind}; -use crate::common::{UI_RUN_STDERR, UI_RUN_STDOUT}; -use crate::compute_diff::{write_diff, write_filtered_diff}; -use crate::errors::{self, Error, ErrorKind}; -use crate::header::TestProps; -use crate::json; -use crate::read2::{read2_abbreviated, Truncated}; -use crate::util::{add_dylib_path, copy_dir_all, dylib_env_var, logv, static_regex, PathBufExt}; -use crate::ColorConfig; -use colored::Colorize; -use miropt_test_tools::{files_for_miropt_test, MiroptTest, MiroptTestFile}; -use regex::{Captures, Regex}; -use rustfix::{apply_suggestions, get_suggestions_from_json, Filter}; use std::collections::{HashMap, HashSet}; -use std::env; use std::ffi::{OsStr, OsString}; use std::fs::{self, create_dir_all, File, OpenOptions}; use std::hash::{DefaultHasher, Hash, Hasher}; use std::io::prelude::*; use std::io::{self, BufReader}; -use std::iter; use std::path::{Path, PathBuf}; use std::process::{Child, Command, ExitStatus, Output, Stdio}; -use std::str; use std::sync::Arc; +use std::{env, iter, str}; use anyhow::Context; +use colored::Colorize; use glob::glob; +use miropt_test_tools::{files_for_miropt_test, MiroptTest, MiroptTestFile}; +use regex::{Captures, Regex}; +use rustfix::{apply_suggestions, get_suggestions_from_json, Filter}; use tracing::*; -use crate::extract_gdb_version; -use crate::is_android_gdb_target; +use crate::common::{ + expected_output_path, incremental_dir, output_base_dir, output_base_name, + output_testname_unique, Assembly, Codegen, CodegenUnits, CompareMode, Config, CoverageMap, + CoverageRun, Crashes, DebugInfo, Debugger, FailMode, Incremental, JsDocTest, MirOpt, PassMode, + Pretty, RunMake, RunPassValgrind, Rustdoc, RustdocJson, TestPaths, Ui, UI_EXTENSIONS, UI_FIXED, + UI_RUN_STDERR, UI_RUN_STDOUT, UI_STDERR, UI_STDOUT, UI_SVG, UI_WINDOWS_SVG, +}; +use crate::compute_diff::{write_diff, write_filtered_diff}; +use crate::errors::{self, Error, ErrorKind}; +use crate::header::TestProps; +use crate::read2::{read2_abbreviated, Truncated}; +use crate::util::{add_dylib_path, copy_dir_all, dylib_env_var, logv, static_regex, PathBufExt}; +use crate::{extract_gdb_version, is_android_gdb_target, json, ColorConfig}; mod coverage; mod debugger; diff --git a/src/tools/compiletest/src/runtest/debugger.rs b/src/tools/compiletest/src/runtest/debugger.rs index ed6cc97a8ab..985fe6381e8 100644 --- a/src/tools/compiletest/src/runtest/debugger.rs +++ b/src/tools/compiletest/src/runtest/debugger.rs @@ -1,12 +1,12 @@ -use crate::common::Config; -use crate::header::line_directive; -use crate::runtest::ProcRes; - use std::fmt::Write; use std::fs::File; use std::io::{BufRead, BufReader}; use std::path::{Path, PathBuf}; +use crate::common::Config; +use crate::header::line_directive; +use crate::runtest::ProcRes; + /// Representation of information to invoke a debugger and check its output pub(super) struct DebuggerCommands { /// Commands for the debuuger diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs index cdec49a51d7..bff02f1db9f 100644 --- a/src/tools/compiletest/src/util.rs +++ b/src/tools/compiletest/src/util.rs @@ -1,4 +1,3 @@ -use crate::common::Config; use std::env; use std::ffi::OsStr; use std::path::{Path, PathBuf}; @@ -6,6 +5,8 @@ use std::process::Command; use tracing::*; +use crate::common::Config; + #[cfg(test)] mod tests; |
