diff options
author | Andy Hayden <andyhayden1@gmail.com> | 2018-11-30 00:30:49 -0800 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-11-30 00:30:49 -0800 |
commit | aab02805dd00a2dd661f141333d7ec6f347b204d (patch) | |
tree | 9866ff1ed876182425cd34cced57bc936c297b8b /src/resources.rs | |
parent | 17994d45423fd5f10e1df347aa8e6962fd1e5bc2 (diff) |
clippy fixes (#1250)
Diffstat (limited to 'src/resources.rs')
-rw-r--r-- | src/resources.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/resources.rs b/src/resources.rs index 36e0d9486..75612e574 100644 --- a/src/resources.rs +++ b/src/resources.rs @@ -66,7 +66,10 @@ enum Repr { TcpStream(tokio::net::TcpStream), HttpBody(HttpBody), Repl(Repl), - Child(tokio_process::Child), + // Enum size is bounded by the largest variant. + // Use `Box` around large `Child` struct. + // https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant + Child(Box<tokio_process::Child>), ChildStdin(tokio_process::ChildStdin), ChildStdout(tokio_process::ChildStdout), ChildStderr(tokio_process::ChildStderr), @@ -258,6 +261,7 @@ pub fn add_repl(repl: Repl) -> Resource { Resource { rid } } +#[cfg_attr(feature = "cargo-clippy", allow(stutter))] pub struct ChildResources { pub child_rid: ResourceId, pub stdin_rid: Option<ResourceId>, @@ -298,10 +302,10 @@ pub fn add_child(mut c: tokio_process::Child) -> ChildResources { resources.stderr_rid = Some(rid); } - let r = tg.insert(child_rid, Repr::Child(c)); + let r = tg.insert(child_rid, Repr::Child(Box::new(c))); assert!(r.is_none()); - return resources; + resources } pub struct ChildStatus { |