mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 21:13:37 +00:00
large_enum_variant
This commit is contained in:
parent
04ccef80cb
commit
e7e09e7750
6 changed files with 17 additions and 13 deletions
|
@ -170,7 +170,6 @@ borrowed_box = "allow"
|
||||||
derived_hash_with_manual_eq = "allow"
|
derived_hash_with_manual_eq = "allow"
|
||||||
forget_non_drop = "allow"
|
forget_non_drop = "allow"
|
||||||
format_collect = "allow"
|
format_collect = "allow"
|
||||||
large_enum_variant = "allow"
|
|
||||||
needless_doctest_main = "allow"
|
needless_doctest_main = "allow"
|
||||||
new_without_default = "allow"
|
new_without_default = "allow"
|
||||||
non_canonical_clone_impl = "allow"
|
non_canonical_clone_impl = "allow"
|
||||||
|
|
|
@ -493,7 +493,9 @@ impl CargoActor {
|
||||||
// Skip certain kinds of messages to only spend time on what's useful
|
// Skip certain kinds of messages to only spend time on what's useful
|
||||||
JsonMessage::Cargo(message) => match message {
|
JsonMessage::Cargo(message) => match message {
|
||||||
cargo_metadata::Message::CompilerArtifact(artifact) if !artifact.fresh => {
|
cargo_metadata::Message::CompilerArtifact(artifact) if !artifact.fresh => {
|
||||||
self.sender.send(CargoMessage::CompilerArtifact(artifact)).unwrap();
|
self.sender
|
||||||
|
.send(CargoMessage::CompilerArtifact(Box::new(artifact)))
|
||||||
|
.unwrap();
|
||||||
}
|
}
|
||||||
cargo_metadata::Message::CompilerMessage(msg) => {
|
cargo_metadata::Message::CompilerMessage(msg) => {
|
||||||
self.sender.send(CargoMessage::Diagnostic(msg.message)).unwrap();
|
self.sender.send(CargoMessage::Diagnostic(msg.message)).unwrap();
|
||||||
|
@ -538,7 +540,7 @@ impl CargoActor {
|
||||||
}
|
}
|
||||||
|
|
||||||
enum CargoMessage {
|
enum CargoMessage {
|
||||||
CompilerArtifact(cargo_metadata::Artifact),
|
CompilerArtifact(Box<cargo_metadata::Artifact>),
|
||||||
Diagnostic(Diagnostic),
|
Diagnostic(Diagnostic),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ impl ProcMacro {
|
||||||
.process
|
.process
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap_or_else(|e| e.into_inner())
|
.unwrap_or_else(|e| e.into_inner())
|
||||||
.send_task(msg::Request::ExpandMacro(task))?;
|
.send_task(msg::Request::ExpandMacro(Box::new(task)))?;
|
||||||
|
|
||||||
match response {
|
match response {
|
||||||
msg::Response::ExpandMacro(it) => {
|
msg::Response::ExpandMacro(it) => {
|
||||||
|
|
|
@ -29,7 +29,7 @@ pub enum Request {
|
||||||
/// Since [`NO_VERSION_CHECK_VERSION`]
|
/// Since [`NO_VERSION_CHECK_VERSION`]
|
||||||
ListMacros { dylib_path: PathBuf },
|
ListMacros { dylib_path: PathBuf },
|
||||||
/// Since [`NO_VERSION_CHECK_VERSION`]
|
/// Since [`NO_VERSION_CHECK_VERSION`]
|
||||||
ExpandMacro(ExpandMacro),
|
ExpandMacro(Box<ExpandMacro>),
|
||||||
/// Since [`VERSION_CHECK_VERSION`]
|
/// Since [`VERSION_CHECK_VERSION`]
|
||||||
ApiVersionCheck {},
|
ApiVersionCheck {},
|
||||||
/// Since [`RUST_ANALYZER_SPAN_SUPPORT`]
|
/// Since [`RUST_ANALYZER_SPAN_SUPPORT`]
|
||||||
|
|
|
@ -45,9 +45,11 @@ fn run() -> io::Result<()> {
|
||||||
msg::Response::ListMacros(srv.list_macros(&dylib_path))
|
msg::Response::ListMacros(srv.list_macros(&dylib_path))
|
||||||
}
|
}
|
||||||
msg::Request::ExpandMacro(task) => match srv.span_mode() {
|
msg::Request::ExpandMacro(task) => match srv.span_mode() {
|
||||||
msg::SpanMode::Id => msg::Response::ExpandMacro(srv.expand(task).map(|(it, _)| it)),
|
msg::SpanMode::Id => {
|
||||||
|
msg::Response::ExpandMacro(srv.expand(*task).map(|(it, _)| it))
|
||||||
|
}
|
||||||
msg::SpanMode::RustAnalyzer => msg::Response::ExpandMacroExtended(
|
msg::SpanMode::RustAnalyzer => msg::Response::ExpandMacroExtended(
|
||||||
srv.expand(task).map(|(tree, span_data_table)| msg::ExpandMacroExtended {
|
srv.expand(*task).map(|(tree, span_data_table)| msg::ExpandMacroExtended {
|
||||||
tree,
|
tree,
|
||||||
span_data_table,
|
span_data_table,
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -60,7 +60,7 @@ pub enum ProjectWorkspace {
|
||||||
cargo: CargoWorkspace,
|
cargo: CargoWorkspace,
|
||||||
build_scripts: WorkspaceBuildScripts,
|
build_scripts: WorkspaceBuildScripts,
|
||||||
sysroot: Result<Sysroot, Option<String>>,
|
sysroot: Result<Sysroot, Option<String>>,
|
||||||
rustc: Result<(CargoWorkspace, WorkspaceBuildScripts), Option<String>>,
|
rustc: Result<Box<(CargoWorkspace, WorkspaceBuildScripts)>, Option<String>>,
|
||||||
/// Holds cfg flags for the current target. We get those by running
|
/// Holds cfg flags for the current target. We get those by running
|
||||||
/// `rustc --print cfg`.
|
/// `rustc --print cfg`.
|
||||||
///
|
///
|
||||||
|
@ -119,7 +119,7 @@ impl fmt::Debug for ProjectWorkspace {
|
||||||
.field("sysroot", &sysroot.is_ok())
|
.field("sysroot", &sysroot.is_ok())
|
||||||
.field(
|
.field(
|
||||||
"n_rustc_compiler_crates",
|
"n_rustc_compiler_crates",
|
||||||
&rustc.as_ref().map_or(0, |(rc, _)| rc.packages().len()),
|
&rustc.as_ref().map(|a| a.as_ref()).map_or(0, |(rc, _)| rc.packages().len()),
|
||||||
)
|
)
|
||||||
.field("n_rustc_cfg", &rustc_cfg.len())
|
.field("n_rustc_cfg", &rustc_cfg.len())
|
||||||
.field("n_cfg_overrides", &cfg_overrides.len())
|
.field("n_cfg_overrides", &cfg_overrides.len())
|
||||||
|
@ -265,7 +265,7 @@ impl ProjectWorkspace {
|
||||||
cargo_toml.parent(),
|
cargo_toml.parent(),
|
||||||
&config.extra_env,
|
&config.extra_env,
|
||||||
);
|
);
|
||||||
Ok((workspace, buildscripts))
|
Ok(Box::new((workspace, buildscripts)))
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
tracing::error!(
|
tracing::error!(
|
||||||
|
@ -603,7 +603,7 @@ impl ProjectWorkspace {
|
||||||
PackageRoot { is_local, include, exclude }
|
PackageRoot { is_local, include, exclude }
|
||||||
})
|
})
|
||||||
.chain(mk_sysroot(sysroot.as_ref(), Some(cargo.workspace_root())))
|
.chain(mk_sysroot(sysroot.as_ref(), Some(cargo.workspace_root())))
|
||||||
.chain(rustc.iter().flat_map(|(rustc, _)| {
|
.chain(rustc.iter().map(|a| a.as_ref()).flat_map(|(rustc, _)| {
|
||||||
rustc.packages().map(move |krate| PackageRoot {
|
rustc.packages().map(move |krate| PackageRoot {
|
||||||
is_local: false,
|
is_local: false,
|
||||||
include: vec![rustc[krate].manifest.parent().to_path_buf()],
|
include: vec![rustc[krate].manifest.parent().to_path_buf()],
|
||||||
|
@ -631,7 +631,8 @@ impl ProjectWorkspace {
|
||||||
sysroot_package_len + project.n_crates()
|
sysroot_package_len + project.n_crates()
|
||||||
}
|
}
|
||||||
ProjectWorkspace::Cargo { cargo, sysroot, rustc, .. } => {
|
ProjectWorkspace::Cargo { cargo, sysroot, rustc, .. } => {
|
||||||
let rustc_package_len = rustc.as_ref().map_or(0, |(it, _)| it.packages().len());
|
let rustc_package_len =
|
||||||
|
rustc.as_ref().map(|a| a.as_ref()).map_or(0, |(it, _)| it.packages().len());
|
||||||
let sysroot_package_len = sysroot.as_ref().map_or(0, |it| it.num_packages());
|
let sysroot_package_len = sysroot.as_ref().map_or(0, |it| it.num_packages());
|
||||||
cargo.packages().len() + sysroot_package_len + rustc_package_len
|
cargo.packages().len() + sysroot_package_len + rustc_package_len
|
||||||
}
|
}
|
||||||
|
@ -672,7 +673,7 @@ impl ProjectWorkspace {
|
||||||
target_layout,
|
target_layout,
|
||||||
} => cargo_to_crate_graph(
|
} => cargo_to_crate_graph(
|
||||||
load,
|
load,
|
||||||
rustc.as_ref().ok(),
|
rustc.as_ref().map(|a| a.as_ref()).ok(),
|
||||||
cargo,
|
cargo,
|
||||||
sysroot.as_ref().ok(),
|
sysroot.as_ref().ok(),
|
||||||
rustc_cfg.clone(),
|
rustc_cfg.clone(),
|
||||||
|
|
Loading…
Reference in a new issue