From f179d64d9ce20fe1684678d3fb31086697156f82 Mon Sep 17 00:00:00 2001 From: James Clarke Date: Mon, 11 Dec 2023 23:31:28 +0000 Subject: [PATCH] Update rendering of empty ranges to not show `inc_lower` (#1177) --- src/print/native.rs | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/print/native.rs b/src/print/native.rs index e5c9a94f3..875f64472 100644 --- a/src/print/native.rs +++ b/src/print/native.rs @@ -274,23 +274,21 @@ impl FormatExt for Value { if !rng.is_empty() { rng.upper().map(|x| &**x).format(prn)?; prn.comma()?; - } - - // These fields are all optional, so we omit them - // when they have the default values. - if !rng.inc_lower() { - prn.tuple_field("inc_lower")?; - prn.const_bool(rng.inc_lower())?; - prn.comma()?; - } - - if rng.inc_upper() { - prn.tuple_field("inc_upper")?; - prn.const_bool(rng.inc_upper())?; - prn.comma()?; - } - if rng.is_empty() { + // These fields are all optional, so we omit them + // when they have the default values. + if !rng.inc_lower() { + prn.tuple_field("inc_lower")?; + prn.const_bool(rng.inc_lower())?; + prn.comma()?; + } + + if rng.inc_upper() { + prn.tuple_field("inc_upper")?; + prn.const_bool(rng.inc_upper())?; + prn.comma()?; + } + } else { prn.tuple_field("empty")?; prn.const_bool(rng.is_empty())?; prn.comma()?;