diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-22 09:47:54 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-22 09:47:54 +0000 |
commit | 696246af7f4d17054c1caa80592cc0b858746260 (patch) | |
tree | 57e252955404bba9978f3a3a3c288a0636a87173 /crates/gen_lsp_server/src/msg.rs | |
parent | 82e3ab02afee7cc0db178e1b10ee65146e4b7a14 (diff) | |
parent | 90f20f8c539843f53a7a2b1cfb83b3673ec78534 (diff) |
Merge #321
321: More useful logging r=matklad a=matklad
Try not to log *huge* messages, to make logging more useful.
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/gen_lsp_server/src/msg.rs')
-rw-r--r-- | crates/gen_lsp_server/src/msg.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/gen_lsp_server/src/msg.rs b/crates/gen_lsp_server/src/msg.rs index af901d0d2..f68cbc541 100644 --- a/crates/gen_lsp_server/src/msg.rs +++ b/crates/gen_lsp_server/src/msg.rs | |||
@@ -152,12 +152,18 @@ impl RawNotification { | |||
152 | params: to_value(params).unwrap(), | 152 | params: to_value(params).unwrap(), |
153 | } | 153 | } |
154 | } | 154 | } |
155 | pub fn is<N>(&self) -> bool | ||
156 | where | ||
157 | N: Notification, | ||
158 | { | ||
159 | self.method == N::METHOD | ||
160 | } | ||
155 | pub fn cast<N>(self) -> ::std::result::Result<N::Params, RawNotification> | 161 | pub fn cast<N>(self) -> ::std::result::Result<N::Params, RawNotification> |
156 | where | 162 | where |
157 | N: Notification, | 163 | N: Notification, |
158 | N::Params: serde::de::DeserializeOwned, | 164 | N::Params: serde::de::DeserializeOwned, |
159 | { | 165 | { |
160 | if self.method != N::METHOD { | 166 | if !self.is::<N>() { |
161 | return Err(self); | 167 | return Err(self); |
162 | } | 168 | } |
163 | Ok(from_value(self.params).unwrap()) | 169 | Ok(from_value(self.params).unwrap()) |