From 088e17a47d8efaee06b1f5e2fabaa939dc70e798 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Wed, 29 Aug 2018 03:15:18 +0200 Subject: menuconfig: Simplify default value info code Just checking whether the default value expression is a single symbol correctly handles the string/int/hex cases too, because that case will always hit for those. D'oh. --- menuconfig.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/menuconfig.py b/menuconfig.py index 3ebf44e..2ef4769 100755 --- a/menuconfig.py +++ b/menuconfig.py @@ -2066,15 +2066,12 @@ def _defaults_info(sc): if isinstance(sc, Symbol): s += _expr_str(val) - # Skip the value hint in these cases: + # Skip the tristate value hint if the expression is just a single + # symbol. _expr_str() already shows its value as a string. # - # - For string/int/hex symbols. The default can only be a single - # symbol there, and it makes no sense to show its tristate value - # (_expr_str() already shows its string value) - # - # - If the expression is just a symbol. _expr_str() already shows - # its value in that case. - if sc.orig_type in (BOOL, TRISTATE) and isinstance(val, tuple): + # This also avoids showing the tristate value for string/int/hex + # defaults, which wouldn't make any sense. + if isinstance(val, tuple): s += ' (={})'.format(TRI_TO_STR[expr_value(val)]) else: # Don't print the value next to the symbol name for choice -- cgit v1.2.3