Skip to content

Commit ecf2faa

Browse files
authored
Rollup merge of rust-lang#94280 - tmiasko:should-print-region, r=oli-obk
Rename `region_should_not_be_omitted` to `should_print_region` to avoid double negation
2 parents 81794be + 1113cd5 commit ecf2faa

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

compiler/rustc_const_eval/src/interpret/intrinsics/type_name.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
149149
}
150150

151151
impl<'tcx> PrettyPrinter<'tcx> for AbsolutePathPrinter<'tcx> {
152-
fn region_should_not_be_omitted(&self, _region: ty::Region<'_>) -> bool {
152+
fn should_print_region(&self, _region: ty::Region<'_>) -> bool {
153153
false
154154
}
155155
fn comma_sep<T>(mut self, mut elems: impl Iterator<Item = T>) -> Result<Self, Self::Error>

compiler/rustc_middle/src/ty/print/pretty.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ pub trait PrettyPrinter<'tcx>:
275275
/// Returns `true` if the region should be printed in
276276
/// optional positions, e.g., `&'a T` or `dyn Tr + 'b`.
277277
/// This is typically the case for all non-`'_` regions.
278-
fn region_should_not_be_omitted(&self, region: ty::Region<'_>) -> bool;
278+
fn should_print_region(&self, region: ty::Region<'_>) -> bool;
279279

280280
// Defaults (should not be overridden):
281281

@@ -577,7 +577,7 @@ pub trait PrettyPrinter<'tcx>:
577577
}
578578
ty::Ref(r, ty, mutbl) => {
579579
p!("&");
580-
if self.region_should_not_be_omitted(r) {
580+
if self.should_print_region(r) {
581581
p!(print(r), " ");
582582
}
583583
p!(print(ty::TypeAndMut { ty, mutbl }))
@@ -621,7 +621,7 @@ pub trait PrettyPrinter<'tcx>:
621621
p!(print_def_path(def.did, substs));
622622
}
623623
ty::Dynamic(data, r) => {
624-
let print_r = self.region_should_not_be_omitted(r);
624+
let print_r = self.should_print_region(r);
625625
if print_r {
626626
p!("(");
627627
}
@@ -1914,7 +1914,7 @@ impl<'tcx, F: fmt::Write> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx, F> {
19141914
Ok(inner)
19151915
}
19161916

1917-
fn region_should_not_be_omitted(&self, region: ty::Region<'_>) -> bool {
1917+
fn should_print_region(&self, region: ty::Region<'_>) -> bool {
19181918
let highlight = self.region_highlight_mode;
19191919
if highlight.region_highlighted(region).is_some() {
19201920
return true;

compiler/rustc_symbol_mangling/src/legacy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ impl<'tcx> Printer<'tcx> for &mut SymbolPrinter<'tcx> {
346346
}
347347

348348
impl<'tcx> PrettyPrinter<'tcx> for &mut SymbolPrinter<'tcx> {
349-
fn region_should_not_be_omitted(&self, _region: ty::Region<'_>) -> bool {
349+
fn should_print_region(&self, _region: ty::Region<'_>) -> bool {
350350
false
351351
}
352352
fn comma_sep<T>(mut self, mut elems: impl Iterator<Item = T>) -> Result<Self, Self::Error>

0 commit comments

Comments
 (0)