diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 6bc4db2c2..4d767d3a2 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -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(()) }