Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
gjtorikian committed Jul 14, 2024
1 parent cca019f commit 0787004
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
7 changes: 3 additions & 4 deletions ext/selma/src/html/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,10 @@ impl SelmaHTMLElement {
.iter()
.for_each(|attr| match hash.aset(attr.name(), attr.value()) {
Ok(_) => {}
Err(err) => Err(Error::new(
Err(err) => panic!("{:?}", Error::new(
exception::runtime_error(),
format!("AttributeNameError: {err:?}"),
))
.unwrap(),
)),
});
}
Ok(hash)
Expand All @@ -139,7 +138,7 @@ impl SelmaHTMLElement {
.for_each(|ancestor| match array.push(RString::new(ancestor)) {
Ok(_) => {}
Err(err) => {
Err(Error::new(exception::runtime_error(), format!("{err:?}"))).unwrap()
panic!("{:?}", Error::new(exception::runtime_error(), format!("{err:?}")))
}
});

Expand Down
3 changes: 1 addition & 2 deletions ext/selma/src/native_ref_wrap.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::{
cell::RefCell,
marker::PhantomData,
sync::{Arc, Mutex},
};
Expand All @@ -22,7 +21,7 @@ impl<'r> Anchor<'r> {

// impl Drop for Anchor<'_> {
// fn drop(&mut self) {
// self.poisoned.replace(true);
// *self.poisoned.lock().unwrap() = true;
// }
// }

Expand Down
6 changes: 3 additions & 3 deletions ext/selma/src/sanitizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ impl SelmaSanitizer {
element: &mut Element,
element_sanitizer: &ElementSanitizer,
attr_name: &String,
attr_val: &String,
attr_val: &str,
) -> Result<bool, AttributeNameError> {
let mut allowed: bool = false;
let element_allowed_attrs = element_sanitizer.allowed_attrs.contains(attr_name);
Expand Down Expand Up @@ -390,7 +390,7 @@ impl SelmaSanitizer {
attr_val.contains("://")
}

fn has_allowed_protocol(protocols_allowed: &[String], attr_val: &String) -> bool {
fn has_allowed_protocol(protocols_allowed: &[String], attr_val: &str) -> bool {
if protocols_allowed.contains(&"all".to_string()) {
return true;
}
Expand Down Expand Up @@ -549,7 +549,7 @@ impl SelmaSanitizer {
) -> &'a mut ElementSanitizer {
element_sanitizers
.entry(element_name.to_string())
.or_insert_with(ElementSanitizer::default)
.or_default()
}
}

Expand Down

0 comments on commit 0787004

Please sign in to comment.