diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-17 08:12:34 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-17 08:12:34 +0000 |
commit | f7fbea509f1e5f840e715c912ee38aa997d1bfbc (patch) | |
tree | 2b4932678fc83624c278ca93cdf0f1d3a28346c2 /crates/proc_macro_api/src | |
parent | 6fcb5d772f16af0d1f62dad55fbde75072fb9e89 (diff) | |
parent | ff5f90d8ae2da8e4856d5c78f55e5cd02b178325 (diff) |
Merge #8063
8063: couple clippy::complexity fixes r=matklad a=matthiaskrgr
avoid redundant `.into()` calls to convert T into identical T (`let x: String = String::from("hello").into();`)
use `if let Some(x)` instead of `.is_some()` + `.unwrap()`
don't clone Copy types
remove redundant wrapped ?s: `Some(Some(3)?)` can just be `Some(3)`
use `.map(|x| y)` instead of `and_then(|x| Some(y)` on `Option`s
Co-authored-by: Matthias Krüger <[email protected]>
Diffstat (limited to 'crates/proc_macro_api/src')
-rw-r--r-- | crates/proc_macro_api/src/process.rs | 2 | ||||
-rw-r--r-- | crates/proc_macro_api/src/rpc.rs | 11 |
2 files changed, 5 insertions, 8 deletions
diff --git a/crates/proc_macro_api/src/process.rs b/crates/proc_macro_api/src/process.rs index 3ce851fe8..30bb1b687 100644 --- a/crates/proc_macro_api/src/process.rs +++ b/crates/proc_macro_api/src/process.rs | |||
@@ -154,5 +154,5 @@ fn send_request( | |||
154 | req: Request, | 154 | req: Request, |
155 | ) -> io::Result<Option<Response>> { | 155 | ) -> io::Result<Option<Response>> { |
156 | req.write(&mut writer)?; | 156 | req.write(&mut writer)?; |
157 | Ok(Response::read(&mut reader)?) | 157 | Response::read(&mut reader) |
158 | } | 158 | } |
diff --git a/crates/proc_macro_api/src/rpc.rs b/crates/proc_macro_api/src/rpc.rs index 64cfdafc5..9a68e2cc5 100644 --- a/crates/proc_macro_api/src/rpc.rs +++ b/crates/proc_macro_api/src/rpc.rs | |||
@@ -236,13 +236,10 @@ mod tests { | |||
236 | subtree | 236 | subtree |
237 | .token_trees | 237 | .token_trees |
238 | .push(TokenTree::Leaf(Ident { text: "Foo".into(), id: TokenId(1) }.into())); | 238 | .push(TokenTree::Leaf(Ident { text: "Foo".into(), id: TokenId(1) }.into())); |
239 | subtree.token_trees.push(TokenTree::Subtree( | 239 | subtree.token_trees.push(TokenTree::Subtree(Subtree { |
240 | Subtree { | 240 | delimiter: Some(Delimiter { id: TokenId(2), kind: DelimiterKind::Brace }), |
241 | delimiter: Some(Delimiter { id: TokenId(2), kind: DelimiterKind::Brace }), | 241 | token_trees: vec![], |
242 | token_trees: vec![], | 242 | })); |
243 | } | ||
244 | .into(), | ||
245 | )); | ||
246 | subtree | 243 | subtree |
247 | } | 244 | } |
248 | 245 | ||