Skip to content

Commit e7e09e7

Browse files
committed
large_enum_variant
1 parent 04ccef8 commit e7e09e7

File tree

6 files changed

+17
-13
lines changed

6 files changed

+17
-13
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ borrowed_box = "allow"
170170
derived_hash_with_manual_eq = "allow"
171171
forget_non_drop = "allow"
172172
format_collect = "allow"
173-
large_enum_variant = "allow"
174173
needless_doctest_main = "allow"
175174
new_without_default = "allow"
176175
non_canonical_clone_impl = "allow"

crates/flycheck/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,9 @@ impl CargoActor {
493493
// Skip certain kinds of messages to only spend time on what's useful
494494
JsonMessage::Cargo(message) => match message {
495495
cargo_metadata::Message::CompilerArtifact(artifact) if !artifact.fresh => {
496-
self.sender.send(CargoMessage::CompilerArtifact(artifact)).unwrap();
496+
self.sender
497+
.send(CargoMessage::CompilerArtifact(Box::new(artifact)))
498+
.unwrap();
497499
}
498500
cargo_metadata::Message::CompilerMessage(msg) => {
499501
self.sender.send(CargoMessage::Diagnostic(msg.message)).unwrap();
@@ -538,7 +540,7 @@ impl CargoActor {
538540
}
539541

540542
enum CargoMessage {
541-
CompilerArtifact(cargo_metadata::Artifact),
543+
CompilerArtifact(Box<cargo_metadata::Artifact>),
542544
Diagnostic(Diagnostic),
543545
}
544546

crates/proc-macro-api/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ impl ProcMacro {
184184
.process
185185
.lock()
186186
.unwrap_or_else(|e| e.into_inner())
187-
.send_task(msg::Request::ExpandMacro(task))?;
187+
.send_task(msg::Request::ExpandMacro(Box::new(task)))?;
188188

189189
match response {
190190
msg::Response::ExpandMacro(it) => {

crates/proc-macro-api/src/msg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub enum Request {
2929
/// Since [`NO_VERSION_CHECK_VERSION`]
3030
ListMacros { dylib_path: PathBuf },
3131
/// Since [`NO_VERSION_CHECK_VERSION`]
32-
ExpandMacro(ExpandMacro),
32+
ExpandMacro(Box<ExpandMacro>),
3333
/// Since [`VERSION_CHECK_VERSION`]
3434
ApiVersionCheck {},
3535
/// Since [`RUST_ANALYZER_SPAN_SUPPORT`]

crates/proc-macro-srv-cli/src/main.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ fn run() -> io::Result<()> {
4545
msg::Response::ListMacros(srv.list_macros(&dylib_path))
4646
}
4747
msg::Request::ExpandMacro(task) => match srv.span_mode() {
48-
msg::SpanMode::Id => msg::Response::ExpandMacro(srv.expand(task).map(|(it, _)| it)),
48+
msg::SpanMode::Id => {
49+
msg::Response::ExpandMacro(srv.expand(*task).map(|(it, _)| it))
50+
}
4951
msg::SpanMode::RustAnalyzer => msg::Response::ExpandMacroExtended(
50-
srv.expand(task).map(|(tree, span_data_table)| msg::ExpandMacroExtended {
52+
srv.expand(*task).map(|(tree, span_data_table)| msg::ExpandMacroExtended {
5153
tree,
5254
span_data_table,
5355
}),

crates/project-model/src/workspace.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub enum ProjectWorkspace {
6060
cargo: CargoWorkspace,
6161
build_scripts: WorkspaceBuildScripts,
6262
sysroot: Result<Sysroot, Option<String>>,
63-
rustc: Result<(CargoWorkspace, WorkspaceBuildScripts), Option<String>>,
63+
rustc: Result<Box<(CargoWorkspace, WorkspaceBuildScripts)>, Option<String>>,
6464
/// Holds cfg flags for the current target. We get those by running
6565
/// `rustc --print cfg`.
6666
///
@@ -119,7 +119,7 @@ impl fmt::Debug for ProjectWorkspace {
119119
.field("sysroot", &sysroot.is_ok())
120120
.field(
121121
"n_rustc_compiler_crates",
122-
&rustc.as_ref().map_or(0, |(rc, _)| rc.packages().len()),
122+
&rustc.as_ref().map(|a| a.as_ref()).map_or(0, |(rc, _)| rc.packages().len()),
123123
)
124124
.field("n_rustc_cfg", &rustc_cfg.len())
125125
.field("n_cfg_overrides", &cfg_overrides.len())
@@ -265,7 +265,7 @@ impl ProjectWorkspace {
265265
cargo_toml.parent(),
266266
&config.extra_env,
267267
);
268-
Ok((workspace, buildscripts))
268+
Ok(Box::new((workspace, buildscripts)))
269269
}
270270
Err(e) => {
271271
tracing::error!(
@@ -603,7 +603,7 @@ impl ProjectWorkspace {
603603
PackageRoot { is_local, include, exclude }
604604
})
605605
.chain(mk_sysroot(sysroot.as_ref(), Some(cargo.workspace_root())))
606-
.chain(rustc.iter().flat_map(|(rustc, _)| {
606+
.chain(rustc.iter().map(|a| a.as_ref()).flat_map(|(rustc, _)| {
607607
rustc.packages().map(move |krate| PackageRoot {
608608
is_local: false,
609609
include: vec![rustc[krate].manifest.parent().to_path_buf()],
@@ -631,7 +631,8 @@ impl ProjectWorkspace {
631631
sysroot_package_len + project.n_crates()
632632
}
633633
ProjectWorkspace::Cargo { cargo, sysroot, rustc, .. } => {
634-
let rustc_package_len = rustc.as_ref().map_or(0, |(it, _)| it.packages().len());
634+
let rustc_package_len =
635+
rustc.as_ref().map(|a| a.as_ref()).map_or(0, |(it, _)| it.packages().len());
635636
let sysroot_package_len = sysroot.as_ref().map_or(0, |it| it.num_packages());
636637
cargo.packages().len() + sysroot_package_len + rustc_package_len
637638
}
@@ -672,7 +673,7 @@ impl ProjectWorkspace {
672673
target_layout,
673674
} => cargo_to_crate_graph(
674675
load,
675-
rustc.as_ref().ok(),
676+
rustc.as_ref().map(|a| a.as_ref()).ok(),
676677
cargo,
677678
sysroot.as_ref().ok(),
678679
rustc_cfg.clone(),

0 commit comments

Comments
 (0)