From baceb02a090fe711ad772d855635bc590826fa53 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Mon, 10 Jul 2023 18:48:29 -0500 Subject: Use refactored Registers type This is an unfortunately noisy change: we need to update virtually all callsites that access the registers. For reads this means passing in the Editor and for writes this means handling potential failure when we can't write to a clipboard register. --- helix-term/src/commands/typed.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'helix-term/src/commands') diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 175f8bc6..28759b3f 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -2285,13 +2285,12 @@ fn clear_register( format!("Invalid register {}", args[0]) ); let register = args[0].chars().next().unwrap_or_default(); - match cx.editor.registers.remove(register) { - Some(_) => cx - .editor - .set_status(format!("Register {} cleared", register)), - None => cx - .editor - .set_error(format!("Register {} not found", register)), + if cx.editor.registers.remove(register) { + cx.editor + .set_status(format!("Register {} cleared", register)); + } else { + cx.editor + .set_error(format!("Register {} not found", register)); } Ok(()) } -- cgit v1.2.3-70-g09d2