rhg: use default configitem in `cat`
authorRaphaël Gomès <rgomes@octobus.net>
Thu, 06 Jul 2023 12:17:20 +0200
changeset 50807 067edf5083a1
parent 50806 50334ab5e5bb
child 50808 67faf1bd8acd
rhg: use default configitem in `cat` Now that we've declared the items, we can get rid of the manual fallback.
rust/rhg/src/commands/cat.rs
--- 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')",