mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
internal: use consistent style for error handling
This commit is contained in:
parent
49318bbae7
commit
6303551cb8
22 changed files with 128 additions and 134 deletions
|
@ -2,13 +2,13 @@
|
|||
|
||||
use std::{env, path::PathBuf, str};
|
||||
|
||||
use anyhow::{bail, format_err, Context, Result};
|
||||
use anyhow::{bail, format_err, Context};
|
||||
use xshell::{cmd, Shell};
|
||||
|
||||
use crate::flags;
|
||||
|
||||
impl flags::Install {
|
||||
pub(crate) fn run(self, sh: &Shell) -> Result<()> {
|
||||
pub(crate) fn run(self, sh: &Shell) -> anyhow::Result<()> {
|
||||
if cfg!(target_os = "macos") {
|
||||
fix_path_for_mac(sh).context("Fix path for mac")?;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ pub(crate) enum Malloc {
|
|||
Jemalloc,
|
||||
}
|
||||
|
||||
fn fix_path_for_mac(sh: &Shell) -> Result<()> {
|
||||
fn fix_path_for_mac(sh: &Shell) -> anyhow::Result<()> {
|
||||
let mut vscode_path: Vec<PathBuf> = {
|
||||
const COMMON_APP_PATH: &str =
|
||||
r"/Applications/Visual Studio Code.app/Contents/Resources/app/bin";
|
||||
|
@ -68,7 +68,7 @@ fn fix_path_for_mac(sh: &Shell) -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn install_client(sh: &Shell, client_opt: ClientOpt) -> Result<()> {
|
||||
fn install_client(sh: &Shell, client_opt: ClientOpt) -> anyhow::Result<()> {
|
||||
let _dir = sh.push_dir("./editors/code");
|
||||
|
||||
// Package extension.
|
||||
|
@ -129,7 +129,7 @@ fn install_client(sh: &Shell, client_opt: ClientOpt) -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn install_server(sh: &Shell, opts: ServerOpt) -> Result<()> {
|
||||
fn install_server(sh: &Shell, opts: ServerOpt) -> anyhow::Result<()> {
|
||||
let features = match opts.malloc {
|
||||
Malloc::System => &[][..],
|
||||
Malloc::Mimalloc => &["--features", "mimalloc"],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue