Skip to content

Commit c1ac4a2

Browse files
committed
Run rustfmt on files that need it.
Somehow these files aren't properly formatted. By default `x fmt` and `x tidy` only check files that have changed against master, so if an ill-formatted file somehow slips in it can stay that way as long as it doesn't get modified(?) I found these when I ran `x fmt` explicitly on every `.rs` file in the repo, while working on rust-lang/compiler-team#750.
1 parent 78dd504 commit c1ac4a2

File tree

8 files changed

+41
-18
lines changed

8 files changed

+41
-18
lines changed

compiler/rustc_codegen_ssa/src/base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ use rustc_middle::middle::debugger_visualizer::{DebuggerVisualizerFile, Debugger
2929
use rustc_middle::middle::exported_symbols;
3030
use rustc_middle::middle::exported_symbols::SymbolExportKind;
3131
use rustc_middle::middle::lang_items;
32-
use rustc_middle::mir::BinOp;
3332
use rustc_middle::mir::mono::{CodegenUnit, CodegenUnitNameBuilder, MonoItem};
33+
use rustc_middle::mir::BinOp;
3434
use rustc_middle::query::Providers;
3535
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout};
3636
use rustc_middle::ty::{self, Instance, Ty, TyCtxt};

compiler/rustc_const_eval/src/const_eval/error.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,9 @@ where
139139
ErrorHandled::TooGeneric(span)
140140
}
141141
err_inval!(AlreadyReported(guar)) => ErrorHandled::Reported(guar, span),
142-
err_inval!(Layout(LayoutError::ReferencesError(guar))) => ErrorHandled::Reported(
143-
ReportedErrorInfo::tainted_by_errors(guar),
144-
span,
145-
),
142+
err_inval!(Layout(LayoutError::ReferencesError(guar))) => {
143+
ErrorHandled::Reported(ReportedErrorInfo::tainted_by_errors(guar), span)
144+
}
146145
// Report remaining errors.
147146
_ => {
148147
let (our_span, frames) = get_span_and_frames();

compiler/rustc_incremental/src/persist/load.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ fn load_dep_graph(sess: &Session) -> LoadResult<(Arc<SerializedDepGraph>, WorkPr
116116

117117
if let LoadResult::Ok { data: (work_products_data, start_pos) } = load_result {
118118
// Decode the list of work_products
119-
let Ok(mut work_product_decoder) =
120-
MemDecoder::new(&work_products_data[..], start_pos)
119+
let Ok(mut work_product_decoder) = MemDecoder::new(&work_products_data[..], start_pos)
121120
else {
122121
sess.dcx().emit_warn(errors::CorruptFile { path: &work_products_path });
123122
return LoadResult::DataOutOfDate;

compiler/rustc_lint/src/for_loops_over_fallibles.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ impl<'tcx> LateLintPass<'tcx> for ForLoopsOverFallibles {
6262
};
6363

6464
let (article, ty, var) = match adt.did() {
65-
did if cx.tcx.is_diagnostic_item(sym::Option, did) && ref_mutability.is_some() => ("a", "Option", "Some"),
65+
did if cx.tcx.is_diagnostic_item(sym::Option, did) && ref_mutability.is_some() => {
66+
("a", "Option", "Some")
67+
}
6668
did if cx.tcx.is_diagnostic_item(sym::Option, did) => ("an", "Option", "Some"),
6769
did if cx.tcx.is_diagnostic_item(sym::Result, did) => ("a", "Result", "Ok"),
6870
_ => return,

library/test/src/bench.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ fn fmt_thousands_sep(mut n: f64, sep: char) -> String {
9898
(0, true) => write!(output, "{:06.2}", n / base as f64).unwrap(),
9999
(0, false) => write!(output, "{:.2}", n / base as f64).unwrap(),
100100
(_, true) => write!(output, "{:03}", n as usize / base).unwrap(),
101-
_ => write!(output, "{}", n as usize / base).unwrap()
101+
_ => write!(output, "{}", n as usize / base).unwrap(),
102102
}
103103
if pow != 0 {
104104
output.push(sep);

src/bootstrap/src/core/builder/tests.rs

+24-5
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,14 @@ fn check_cli<const N: usize>(paths: [&str; N]) {
6060
macro_rules! std {
6161
($host:ident => $target:ident, stage = $stage:literal) => {
6262
compile::Std::new(
63-
Compiler { host: TargetSelection::from_user(concat!(stringify!($host), "-", stringify!($host))), stage: $stage },
63+
Compiler {
64+
host: TargetSelection::from_user(concat!(
65+
stringify!($host),
66+
"-",
67+
stringify!($host)
68+
)),
69+
stage: $stage,
70+
},
6471
TargetSelection::from_user(concat!(stringify!($target), "-", stringify!($target))),
6572
)
6673
};
@@ -83,7 +90,14 @@ macro_rules! doc_std {
8390
macro_rules! rustc {
8491
($host:ident => $target:ident, stage = $stage:literal) => {
8592
compile::Rustc::new(
86-
Compiler { host: TargetSelection::from_user(concat!(stringify!($host), "-", stringify!($host))), stage: $stage },
93+
Compiler {
94+
host: TargetSelection::from_user(concat!(
95+
stringify!($host),
96+
"-",
97+
stringify!($host)
98+
)),
99+
stage: $stage,
100+
},
87101
TargetSelection::from_user(concat!(stringify!($target), "-", stringify!($target))),
88102
)
89103
};
@@ -141,10 +155,14 @@ fn check_missing_paths_for_x_test_tests() {
141155

142156
// Skip if not a test directory.
143157
if path.ends_with("tests/auxiliary") || !path.is_dir() {
144-
continue
158+
continue;
145159
}
146160

147-
assert!(tests_remap_paths.iter().any(|item| path.ends_with(*item)), "{} is missing in PATH_REMAP tests list.", path.display());
161+
assert!(
162+
tests_remap_paths.iter().any(|item| path.ends_with(*item)),
163+
"{} is missing in PATH_REMAP tests list.",
164+
path.display()
165+
);
148166
}
149167
}
150168

@@ -185,7 +203,8 @@ fn alias_and_path_for_library() {
185203
&[std!(A => A, stage = 0), std!(A => A, stage = 1)]
186204
);
187205

188-
let mut cache = run_build(&["library".into(), "core".into()], configure("doc", &["A-A"], &["A-A"]));
206+
let mut cache =
207+
run_build(&["library".into(), "core".into()], configure("doc", &["A-A"], &["A-A"]));
189208
assert_eq!(first(cache.all::<doc::Std>()), &[doc_std!(A => A, stage = 0)]);
190209
}
191210

src/bootstrap/src/core/sanity.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,15 @@ than building it.
199199
if !["A-A", "B-B", "C-C"].contains(&target_str.as_str()) {
200200
let mut has_target = false;
201201

202-
let missing_targets_hashset: HashSet<_> = STAGE0_MISSING_TARGETS.iter().map(|t| t.to_string()).collect();
203-
let duplicated_targets: Vec<_> = stage0_supported_target_list.intersection(&missing_targets_hashset).collect();
202+
let missing_targets_hashset: HashSet<_> =
203+
STAGE0_MISSING_TARGETS.iter().map(|t| t.to_string()).collect();
204+
let duplicated_targets: Vec<_> =
205+
stage0_supported_target_list.intersection(&missing_targets_hashset).collect();
204206

205207
if !duplicated_targets.is_empty() {
206-
println!("Following targets supported from the stage0 compiler, please remove them from STAGE0_MISSING_TARGETS list.");
208+
println!(
209+
"Following targets supported from the stage0 compiler, please remove them from STAGE0_MISSING_TARGETS list."
210+
);
207211
for duplicated_target in duplicated_targets {
208212
println!(" {duplicated_target}");
209213
}

src/tools/build_helper/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pub mod ci;
22
pub mod git;
33
pub mod metrics;
4-
pub mod util;
54
pub mod stage0_parser;
5+
pub mod util;

0 commit comments

Comments
 (0)