Skip to content

Commit

Permalink
Use idiomatic Rc::clone
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbbot committed Jan 18, 2022
1 parent 308e646 commit 3bdaef4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,17 @@ impl IntoNativeHandlers<NativeElementContentHandlers<'static>> for ElementConten
let mut native = NativeElementContentHandlers::default();

if let Some(handler) = self.element() {
let this = handlers.clone();
let this = Rc::clone(&handlers);
native = native.element(make_handler!(handler, Element, this, stack_ptr));
}

if let Some(handler) = self.comments() {
let this = handlers.clone();
let this = Rc::clone(&handlers);
native = native.comments(make_handler!(handler, Comment, this, stack_ptr));
}

if let Some(handler) = self.text() {
let this = handlers.clone();
let this = Rc::clone(&handlers);
native = native.text(make_handler!(handler, TextChunk, this, stack_ptr));
}

Expand Down Expand Up @@ -118,22 +118,22 @@ impl IntoNativeHandlers<NativeDocumentContentHandlers<'static>> for DocumentCont
let mut native = NativeDocumentContentHandlers::default();

if let Some(handler) = self.doctype() {
let this = handlers.clone();
let this = Rc::clone(&handlers);
native = native.doctype(make_handler!(handler, Doctype, this, stack_ptr));
}

if let Some(handler) = self.comments() {
let this = handlers.clone();
let this = Rc::clone(&handlers);
native = native.comments(make_handler!(handler, Comment, this, stack_ptr));
}

if let Some(handler) = self.text() {
let this = handlers.clone();
let this = Rc::clone(&handlers);
native = native.text(make_handler!(handler, TextChunk, this, stack_ptr));
}

if let Some(handler) = self.end() {
let this = handlers.clone();
let this = Rc::clone(&handlers);
native = native.end(make_handler!(handler, DocumentEnd, this, stack_ptr));
}

Expand Down

0 comments on commit 3bdaef4

Please sign in to comment.