Skip to content

Commit 85cdce7

Browse files
Axlefublrnik-rev
andcommitted
eval out of range error lazily
Co-authored-by: Nik Revenco <pm@nikrev.com>
1 parent c4887e5 commit 85cdce7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

helix-term/src/commands/typed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ fn buffer_nth(cx: &mut compositor::Context, args: Args, event: PromptEvent) -> a
388388
} else {
389389
cx.editor.documents.iter().nth(n - 1)
390390
}
391-
.ok_or(anyhow!("buffer {n} is out of range"))?;
391+
.ok_or_else(|| anyhow!("buffer {n} is out of range"))?;
392392
cx.editor.switch(*id, helix_view::editor::Action::Replace);
393393
Ok(())
394394
}

0 commit comments

Comments
 (0)