diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-02-23 12:26:47 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-23 12:26:47 +0100 |
| commit | ecf2faacfffe42a12caf75144ed51a836353267e (patch) | |
| tree | a01b9c0fba7b8c52e2ae60a6ac481e8d39f9cef4 | |
| parent | 81794bed123d1441e64578a5a4ada74c1877fd8f (diff) | |
| parent | 1113cd5bbe81d4c94dd95e5d376869fb4516335e (diff) | |
| download | rust-ecf2faacfffe42a12caf75144ed51a836353267e.tar.gz rust-ecf2faacfffe42a12caf75144ed51a836353267e.zip | |
Rollup merge of #94280 - tmiasko:should-print-region, r=oli-obk
Rename `region_should_not_be_omitted` to `should_print_region` to avoid double negation
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/intrinsics/type_name.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/print/pretty.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_symbol_mangling/src/legacy.rs | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/intrinsics/type_name.rs b/compiler/rustc_const_eval/src/interpret/intrinsics/type_name.rs index e6f243e28db..aa84b16b502 100644 --- a/compiler/rustc_const_eval/src/interpret/intrinsics/type_name.rs +++ b/compiler/rustc_const_eval/src/interpret/intrinsics/type_name.rs @@ -149,7 +149,7 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> { } impl<'tcx> PrettyPrinter<'tcx> for AbsolutePathPrinter<'tcx> { - fn region_should_not_be_omitted(&self, _region: ty::Region<'_>) -> bool { + fn should_print_region(&self, _region: ty::Region<'_>) -> bool { false } fn comma_sep<T>(mut self, mut elems: impl Iterator<Item = T>) -> Result<Self, Self::Error> diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 359e4f5e581..403315a7a78 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -275,7 +275,7 @@ pub trait PrettyPrinter<'tcx>: /// Returns `true` if the region should be printed in /// optional positions, e.g., `&'a T` or `dyn Tr + 'b`. /// This is typically the case for all non-`'_` regions. - fn region_should_not_be_omitted(&self, region: ty::Region<'_>) -> bool; + fn should_print_region(&self, region: ty::Region<'_>) -> bool; // Defaults (should not be overridden): @@ -577,7 +577,7 @@ pub trait PrettyPrinter<'tcx>: } ty::Ref(r, ty, mutbl) => { p!("&"); - if self.region_should_not_be_omitted(r) { + if self.should_print_region(r) { p!(print(r), " "); } p!(print(ty::TypeAndMut { ty, mutbl })) @@ -621,7 +621,7 @@ pub trait PrettyPrinter<'tcx>: p!(print_def_path(def.did, substs)); } ty::Dynamic(data, r) => { - let print_r = self.region_should_not_be_omitted(r); + let print_r = self.should_print_region(r); if print_r { p!("("); } @@ -1914,7 +1914,7 @@ impl<'tcx, F: fmt::Write> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx, F> { Ok(inner) } - fn region_should_not_be_omitted(&self, region: ty::Region<'_>) -> bool { + fn should_print_region(&self, region: ty::Region<'_>) -> bool { let highlight = self.region_highlight_mode; if highlight.region_highlighted(region).is_some() { return true; diff --git a/compiler/rustc_symbol_mangling/src/legacy.rs b/compiler/rustc_symbol_mangling/src/legacy.rs index cec1d4bc157..47bf0fe1221 100644 --- a/compiler/rustc_symbol_mangling/src/legacy.rs +++ b/compiler/rustc_symbol_mangling/src/legacy.rs @@ -346,7 +346,7 @@ impl<'tcx> Printer<'tcx> for &mut SymbolPrinter<'tcx> { } impl<'tcx> PrettyPrinter<'tcx> for &mut SymbolPrinter<'tcx> { - fn region_should_not_be_omitted(&self, _region: ty::Region<'_>) -> bool { + fn should_print_region(&self, _region: ty::Region<'_>) -> bool { false } fn comma_sep<T>(mut self, mut elems: impl Iterator<Item = T>) -> Result<Self, Self::Error> |
