mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-29 07:59:00 +00:00
style: use helper instead of buiding UserError by hand
This commit is contained in:
parent
a7e2c06068
commit
39226fc127
1 changed files with 4 additions and 8 deletions
|
@ -3146,14 +3146,10 @@ fn cmd_workspace_root(
|
|||
_args: &WorkspaceRootArgs,
|
||||
) -> Result<(), CommandError> {
|
||||
let workspace_command = command.workspace_helper(ui)?;
|
||||
let root =
|
||||
workspace_command
|
||||
.workspace_root()
|
||||
.to_str()
|
||||
.ok_or_else(|| CommandError::UserError {
|
||||
message: String::from("The workspace root is not valid UTF-8"),
|
||||
hint: None,
|
||||
})?;
|
||||
let root = workspace_command
|
||||
.workspace_root()
|
||||
.to_str()
|
||||
.ok_or_else(|| user_error("The workspace root is not valid UTF-8"))?;
|
||||
writeln!(ui, "{root}")?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue