Closed
Description
I have a code that looks like this:
macro_rules! try_opt {
($expr: expr) => {
match $expr {
Some(value) => value,
None => return None
}
}
}
Some(Node(try_opt!(self.0.borrow().first_child.as_ref()).clone()))
Clippy suggestion:
--> src/dom/node.rs:194:19
|
194 | Some(Node(try_opt!(self.0.borrow().first_child.as_ref()).clone()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.162/index.html#clone_on_ref_ptr
help: try this
|
194 | Some(Node(Rc::clone(&match $expr {
195 | Some(value) => value,
196 | None => return None
197 | })))
So it's trying to expand a macro, but badly.