Skip to content

Commit b75d2b8

Browse files
committed
Perform a nightly group_imports rustfmt pass
1 parent 9b33aab commit b75d2b8

22 files changed

+192
-227
lines changed

src/aux_builds.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
//! Everything needed to build auxilary files with rustc
22
// lol we can't name this file `aux.rs` on windows
33

4-
use bstr::ByteSlice;
5-
use spanned::Spanned;
6-
use std::{ffi::OsString, path::PathBuf, process::Command, sync::Arc};
7-
84
use crate::{
95
build_manager::{Build, BuildManager},
106
custom_flags::Flag,
@@ -13,6 +9,9 @@ use crate::{
139
status_emitter::SilentStatus,
1410
CrateType, Error, Errored,
1511
};
12+
use bstr::ByteSlice;
13+
use spanned::Spanned;
14+
use std::{ffi::OsString, path::PathBuf, process::Command, sync::Arc};
1615

1716
impl Flag for AuxBuilder {
1817
fn must_be_unique(&self) -> bool {

src/build_manager.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
//! Auxiliary and dependency builder. Extendable to custom builds.
22
3-
use std::{
4-
collections::{hash_map::Entry, HashMap},
5-
ffi::OsString,
6-
sync::{Arc, OnceLock, RwLock},
7-
};
8-
9-
use color_eyre::eyre::Result;
10-
use crossbeam_channel::{bounded, Sender};
11-
123
use crate::{
134
status_emitter::{RevisionStyle, TestStatus},
145
test_result::TestRun,
156
Config, Errored,
167
};
8+
use color_eyre::eyre::Result;
9+
use crossbeam_channel::{bounded, Sender};
10+
use std::{
11+
collections::{hash_map::Entry, HashMap},
12+
ffi::OsString,
13+
sync::{Arc, OnceLock, RwLock},
14+
};
1715

1816
/// A build shared between all tests of the same `BuildManager`
1917
pub trait Build {

src/cmd.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1+
use crate::display;
12
use std::{
23
ffi::OsString,
34
path::{Path, PathBuf},
45
process::Command,
56
};
67

7-
use crate::display;
8-
98
#[derive(Debug, Clone)]
109
/// A command, its args and its environment. Used for
1110
/// the main command, the dependency builder and the cfg-reader.

src/config.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
use regex::bytes::Regex;
2-
use spanned::Spanned;
3-
41
#[cfg(feature = "rustc")]
52
use crate::{
63
aux_builds::AuxBuilder, custom_flags::run::Run, custom_flags::rustfix::RustfixMode,
@@ -14,6 +11,8 @@ use crate::{
1411
};
1512
pub use color_eyre;
1613
use color_eyre::eyre::Result;
14+
use regex::bytes::Regex;
15+
use spanned::Spanned;
1716
use std::{
1817
collections::BTreeMap,
1918
num::NonZeroUsize,

src/config/args.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//! Default argument processing when `ui_test` is used
22
//! as a test driver.
33
4-
use std::{borrow::Cow, num::NonZeroUsize};
5-
64
use color_eyre::eyre::{bail, ensure, Result};
5+
use std::{borrow::Cow, num::NonZeroUsize};
76

87
/// Plain arguments if `ui_test` is used as a binary.
98
#[derive(Debug, Default)]

src/custom_flags.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
//! Define custom test flags not natively supported by ui_test
22
3+
use crate::{
4+
build_manager::BuildManager, parser::Comments, per_test_config::TestConfig, Config, Errored,
5+
};
36
use std::{
47
panic::{RefUnwindSafe, UnwindSafe},
58
process::{Command, Output},
69
};
710

8-
use crate::{
9-
build_manager::BuildManager, parser::Comments, per_test_config::TestConfig, Config, Errored,
10-
};
11-
1211
#[cfg(feature = "rustc")]
1312
pub mod edition;
1413
#[cfg(feature = "rustc")]

src/custom_flags/edition.rs

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
1-
//! Custom flag for setting the edition for all tests
2-
3-
use crate::{build_manager::BuildManager, per_test_config::TestConfig, Errored};
4-
5-
use super::Flag;
6-
7-
#[derive(Debug)]
8-
/// Set the edition of the tests
9-
pub struct Edition(pub String);
10-
11-
impl Flag for Edition {
12-
fn must_be_unique(&self) -> bool {
13-
true
14-
}
15-
fn clone_inner(&self) -> Box<dyn Flag> {
16-
Box::new(Edition(self.0.clone()))
17-
}
18-
19-
fn apply(
20-
&self,
21-
cmd: &mut std::process::Command,
22-
_config: &TestConfig,
23-
_build_manager: &BuildManager,
24-
) -> Result<(), Errored> {
25-
cmd.arg("--edition").arg(&self.0);
26-
Ok(())
27-
}
28-
}
1+
//! Custom flag for setting the edition for all tests
2+
3+
use super::Flag;
4+
use crate::{build_manager::BuildManager, per_test_config::TestConfig, Errored};
5+
6+
#[derive(Debug)]
7+
/// Set the edition of the tests
8+
pub struct Edition(pub String);
9+
10+
impl Flag for Edition {
11+
fn must_be_unique(&self) -> bool {
12+
true
13+
}
14+
fn clone_inner(&self) -> Box<dyn Flag> {
15+
Box::new(Edition(self.0.clone()))
16+
}
17+
18+
fn apply(
19+
&self,
20+
cmd: &mut std::process::Command,
21+
_config: &TestConfig,
22+
_build_manager: &BuildManager,
23+
) -> Result<(), Errored> {
24+
cmd.arg("--edition").arg(&self.0);
25+
Ok(())
26+
}
27+
}

src/custom_flags/run.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
//! Types used for running tests after they pass compilation
22
3-
use bstr::ByteSlice;
4-
use spanned::Spanned;
5-
use std::{path::Path, process::Output};
6-
3+
use super::Flag;
74
use crate::{
85
build_manager::BuildManager, display, per_test_config::TestConfig,
9-
status_emitter::RevisionStyle, CommandBuilder, Error, Errored, OutputConflictHandling, TestOk, TestRun,
6+
status_emitter::RevisionStyle, CommandBuilder, Error, Errored, OutputConflictHandling, TestOk,
7+
TestRun,
108
};
11-
12-
use super::Flag;
9+
use bstr::ByteSlice;
10+
use spanned::Spanned;
11+
use std::{path::Path, process::Output};
1312

1413
#[derive(Debug, Copy, Clone)]
1514
/// Run a test after successfully compiling it

src/custom_flags/rustfix.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11
//! All the logic needed to run rustfix on a test that failed compilation
22
3-
use std::{
4-
collections::HashSet,
5-
path::{Path, PathBuf},
6-
process::Output,
7-
sync::Arc,
8-
};
9-
10-
use rustfix::{CodeFix, Filter, Suggestion};
11-
use spanned::{Span, Spanned};
12-
3+
use super::Flag;
134
use crate::{
145
build_manager::BuildManager,
156
display,
167
parser::OptWithLine,
178
per_test_config::{Comments, Revisioned, TestConfig},
189
Error, Errored, TestOk, TestRun,
1910
};
20-
21-
use super::Flag;
11+
use rustfix::{CodeFix, Filter, Suggestion};
12+
use spanned::{Span, Spanned};
13+
use std::{
14+
collections::HashSet,
15+
path::{Path, PathBuf},
16+
process::Output,
17+
sync::Arc,
18+
};
2219

2320
/// When to run rustfix on tests
2421
#[derive(Copy, Clone, Debug, PartialEq, Eq)]

src/dependencies.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
//! Use `cargo` to build dependencies and make them available in your tests
22
3+
use crate::{
4+
build_manager::{Build, BuildManager},
5+
custom_flags::Flag,
6+
per_test_config::TestConfig,
7+
test_result::Errored,
8+
CommandBuilder, Config,
9+
};
310
use bstr::ByteSlice;
411
use cargo_metadata::{camino::Utf8PathBuf, BuildScript, DependencyKind};
512
use cargo_platform::Cfg;
@@ -11,14 +18,6 @@ use std::{
1118
str::FromStr,
1219
};
1320

14-
use crate::{
15-
build_manager::{Build, BuildManager},
16-
custom_flags::Flag,
17-
per_test_config::TestConfig,
18-
test_result::Errored,
19-
CommandBuilder, Config,
20-
};
21-
2221
#[derive(Default, Debug)]
2322
/// Describes where to find the binaries built for the dependencies
2423
pub struct Dependencies {

0 commit comments

Comments
 (0)