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
This commit is contained in:
Matthias Krüger 2022-02-23 12:26:47 +01:00 committed by GitHub
commit ecf2faacff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -149,7 +149,7 @@ fn path_generic_args(
}
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>

View File

@ -275,7 +275,7 @@ fn generic_delimiters(
/// 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 @@ fn pretty_print_type(mut self, ty: Ty<'tcx>) -> Result<Self::Type, Self::Error>
}
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 @@ fn pretty_print_type(mut self, ty: Ty<'tcx>) -> Result<Self::Type, Self::Error>
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 @@ fn generic_delimiters(
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;

View File

@ -346,7 +346,7 @@ fn path_generic_args(
}
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>