mirror of https://github.com/helix-editor/helix
minor: Use anchor::ensure in some cases
parent
3e15aead4a
commit
d562e13e1f
|
@ -24,7 +24,7 @@ use helix_view::{
|
||||||
Document, DocumentId, Editor, ViewId,
|
Document, DocumentId, Editor, ViewId,
|
||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::{anyhow, bail, Context as _};
|
use anyhow::{anyhow, bail, ensure, Context as _};
|
||||||
use helix_lsp::{
|
use helix_lsp::{
|
||||||
block_on, lsp,
|
block_on, lsp,
|
||||||
util::{lsp_pos_to_pos, lsp_range_to_range, pos_to_lsp_pos, range_to_lsp_range},
|
util::{lsp_pos_to_pos, lsp_range_to_range, pos_to_lsp_pos, range_to_lsp_range},
|
||||||
|
@ -2550,9 +2550,7 @@ mod cmd {
|
||||||
args: &[&str],
|
args: &[&str],
|
||||||
_event: PromptEvent,
|
_event: PromptEvent,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
if args.is_empty() {
|
ensure!(!args.is_empty(), "Line number required");
|
||||||
bail!("Line number required");
|
|
||||||
}
|
|
||||||
|
|
||||||
let line = args[0].parse::<usize>()?;
|
let line = args[0].parse::<usize>()?;
|
||||||
|
|
||||||
|
@ -5553,9 +5551,7 @@ fn shell_impl(
|
||||||
) -> anyhow::Result<(Tendril, bool)> {
|
) -> anyhow::Result<(Tendril, bool)> {
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::process::{Command, Stdio};
|
use std::process::{Command, Stdio};
|
||||||
if shell.is_empty() {
|
ensure!(!shell.is_empty(), "No shell set");
|
||||||
bail!("No shell set");
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut process = match Command::new(&shell[0])
|
let mut process = match Command::new(&shell[0])
|
||||||
.args(&shell[1..])
|
.args(&shell[1..])
|
||||||
|
|
Loading…
Reference in New Issue