use cfg::{CfgAtom, CfgExpr};
use ide::{FileId, RunnableKind, TestId};
-use project_model::{self, TargetKind};
+use project_model::{self, ManifestPath, TargetKind};
use vfs::AbsPathBuf;
use crate::{global_state::GlobalStateSnapshot, Result};
#[derive(Clone)]
pub(crate) struct CargoTargetSpec {
pub(crate) workspace_root: AbsPathBuf,
- pub(crate) cargo_toml: AbsPathBuf,
+ pub(crate) cargo_toml: ManifestPath,
pub(crate) package: String,
pub(crate) target: String,
pub(crate) target_kind: TargetKind,
let res = CargoTargetSpec {
workspace_root: cargo_ws.workspace_root().to_path_buf(),
cargo_toml: package_data.manifest.clone(),
- package: cargo_ws.package_flag(&package_data),
+ package: cargo_ws.package_flag(package_data),
target: target_data.name.clone(),
target_kind: target_data.kind,
};
TargetKind::Lib => {
buf.push("--lib".to_string());
}
- TargetKind::Other => (),
+ TargetKind::Other | TargetKind::BuildScript => (),
}
}
}
let cfg_expr = {
let source_file = ast::SourceFile::parse(cfg).ok().unwrap();
let tt = source_file.syntax().descendants().find_map(ast::TokenTree::cast).unwrap();
- let (tt, _) = ast_to_token_tree(&tt).unwrap();
+ let (tt, _) = ast_to_token_tree(&tt);
CfgExpr::parse(&tt)
};