Skip to content

Commit 5bf6a46

Browse files
committed
Replace some thens with some then_somes
1 parent 8751fa1 commit 5bf6a46

File tree

24 files changed

+27
-26
lines changed

24 files changed

+27
-26
lines changed

compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ impl<'a> AstValidator<'a> {
271271

272272
self.session.emit_err(InvalidVisibility {
273273
span: vis.span,
274-
implied: vis.kind.is_pub().then(|| vis.span),
274+
implied: vis.kind.is_pub().then_some(vis.span),
275275
note,
276276
});
277277
}

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
11861186
return None;
11871187
};
11881188
debug!("checking call args for uses of inner_param: {:?}", args);
1189-
args.contains(&Operand::Move(inner_param)).then(|| (loc, term))
1189+
args.contains(&Operand::Move(inner_param)).then_some((loc, term))
11901190
}) else {
11911191
debug!("no uses of inner_param found as a by-move call arg");
11921192
return;

compiler/rustc_builtin_macros/src/standard_library_imports.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub fn inject(
6262
// the one with the prelude.
6363
let name = names[0];
6464

65-
let root = (edition == Edition2015).then(|| kw::PathRoot);
65+
let root = (edition == Edition2015).then_some(kw::PathRoot);
6666

6767
let import_path = root
6868
.iter()

compiler/rustc_codegen_llvm/src/type_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ fn struct_llfields<'a, 'tcx>(
154154
} else {
155155
debug!("struct_llfields: offset: {:?} stride: {:?}", offset, layout.size);
156156
}
157-
let field_remapping = padding_used.then(|| field_remapping);
157+
let field_remapping = padding_used.then_some(field_remapping);
158158
(result, packed, field_remapping)
159159
}
160160

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2024,7 +2024,7 @@ fn linker_with_args<'a>(
20242024
.native_libraries
20252025
.iter()
20262026
.filter_map(|(cnum, libraries)| {
2027-
(dependency_linkage[cnum.as_usize() - 1] != Linkage::Static).then(|| libraries)
2027+
(dependency_linkage[cnum.as_usize() - 1] != Linkage::Static).then_some(libraries)
20282028
})
20292029
.flatten();
20302030
for (raw_dylib_name, raw_dylib_imports) in

compiler/rustc_expand/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ impl<'a> StripUnconfigured<'a> {
255255

256256
fn configure_krate_attrs(&self, mut attrs: ast::AttrVec) -> Option<ast::AttrVec> {
257257
attrs.flat_map_in_place(|attr| self.process_cfg_attr(attr));
258-
self.in_cfg(&attrs).then(|| attrs)
258+
self.in_cfg(&attrs).then_some(attrs)
259259
}
260260

261261
/// Performs cfg-expansion on `stream`, producing a new `AttrTokenStream`.

compiler/rustc_hir_analysis/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) {
204204
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id.expect_local());
205205
match tcx.hir().find(hir_id) {
206206
Some(Node::Item(hir::Item { kind: hir::ItemKind::Fn(_, generics, _), .. })) => {
207-
generics.params.is_empty().not().then(|| generics.span)
207+
generics.params.is_empty().not().then_some(generics.span)
208208
}
209209
_ => {
210210
span_bug!(tcx.def_span(def_id), "main has a non-function type");

compiler/rustc_hir_typeck/src/coercion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10461046
self.param_env,
10471047
)
10481048
.may_apply()
1049-
.then(|| deref_ty)
1049+
.then_some(deref_ty)
10501050
})
10511051
}
10521052

compiler/rustc_lint/src/builtin.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2308,7 +2308,8 @@ impl EarlyLintPass for IncompleteFeatures {
23082308
.for_each(|(&name, &span)| {
23092309
let note = rustc_feature::find_feature_issue(name, GateIssue::Language)
23102310
.map(|n| BuiltinIncompleteFeaturesNote { n });
2311-
let help = HAS_MIN_FEATURES.contains(&name).then(|| BuiltinIncompleteFeaturesHelp);
2311+
let help =
2312+
HAS_MIN_FEATURES.contains(&name).then_some(BuiltinIncompleteFeaturesHelp);
23122313
cx.emit_spanned_lint(
23132314
INCOMPLETE_FEATURES,
23142315
span,

compiler/rustc_lint/src/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ impl LintStore {
487487
let mut groups: Vec<_> = self
488488
.lint_groups
489489
.iter()
490-
.filter_map(|(k, LintGroup { depr, .. })| depr.is_none().then(|| k))
490+
.filter_map(|(k, LintGroup { depr, .. })| depr.is_none().then_some(k))
491491
.collect();
492492
groups.sort();
493493
let groups = groups.iter().map(|k| Symbol::intern(k));

0 commit comments

Comments
 (0)