mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Merge pull request #2732 from detrumi/cargo-toml-not-found-message-toggle
Flag to hide cargo.toml not found error
This commit is contained in:
commit
cf5bdf464c
4 changed files with 37 additions and 19 deletions
|
@ -23,9 +23,19 @@ pub use crate::{
|
|||
sysroot::Sysroot,
|
||||
};
|
||||
|
||||
// FIXME use proper error enum
|
||||
pub type Result<T> = ::std::result::Result<T, Box<dyn Error + Send + Sync>>;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
|
||||
pub struct CargoTomlNotFoundError(pub PathBuf);
|
||||
|
||||
impl std::fmt::Display for CargoTomlNotFoundError {
|
||||
fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(fmt, "can't find Cargo.toml at {}", self.0.display())
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for CargoTomlNotFoundError {}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum ProjectWorkspace {
|
||||
/// Project workspace was discovered by running `cargo metadata` and `rustc --print sysroot`.
|
||||
|
@ -362,7 +372,7 @@ fn find_cargo_toml(path: &Path) -> Result<PathBuf> {
|
|||
}
|
||||
curr = path.parent();
|
||||
}
|
||||
Err(format!("can't find Cargo.toml at {}", path.display()))?
|
||||
Err(CargoTomlNotFoundError(path.to_path_buf()))?
|
||||
}
|
||||
|
||||
pub fn get_rustc_cfg_options() -> CfgOptions {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue