changeset 50807:067edf5083a1

rhg: use default configitem in `cat` Now that we've declared the items, we can get rid of the manual fallback.
author Raphaël Gomès <rgomes@octobus.net>
date Thu, 06 Jul 2023 12:17:20 +0200
parents 50334ab5e5bb
children 67faf1bd8acd
files rust/rhg/src/commands/cat.rs
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/rust/rhg/src/commands/cat.rs	Thu Jul 06 11:47:41 2023 +0200
+++ b/rust/rhg/src/commands/cat.rs	Thu Jul 06 12:17:20 2023 +0200
@@ -32,9 +32,8 @@
 
 #[logging_timer::time("trace")]
 pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> {
-    let cat_enabled_default = true;
-    let cat_enabled = invocation.config.get_option(b"rhg", b"cat")?;
-    if !cat_enabled.unwrap_or(cat_enabled_default) {
+    let cat_enabled = invocation.config.get_bool(b"rhg", b"cat")?;
+    if !cat_enabled {
         return Err(CommandError::unsupported(
             "cat is disabled in rhg (enable it with 'rhg.cat = true' \
             or enable fallback with 'rhg.on-unsupported = fallback')",