Skip to content

Commit eda3030

Browse files
authored
Fix fmt and clippy errors (#571)
* Enable "full" feature for syn This feature was previously required to compile, but not specified. That worked because some other dependency enabled it, but we must not rely on that. Signed-off-by: Simon Wülker <[email protected]> * cargo clippy --fix Signed-off-by: Simon Wülker <[email protected]> * cargo fmt Signed-off-by: Simon Wülker <[email protected]> * Fix resolver declaration The key is workspace.resolver, so declaring the resolver under workspace.dependencies.resolver is wrong. Signed-off-by: Simon Wülker <[email protected]> --------- Signed-off-by: Simon Wülker <[email protected]>
1 parent 24df05e commit eda3030

File tree

6 files changed

+16
-11
lines changed

6 files changed

+16
-11
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ members = [
77
"match_token"
88
]
99

10+
resolver = "2"
11+
1012
[workspace.dependencies]
1113
match_token = { path = "match_token" }
1214

13-
resolver = "2"

html5ever/src/tree_builder/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,11 +1392,12 @@ where
13921392
// template start tag's shadowrootmode is not in the none state
13931393
let is_shadow_root_mode = tag.attrs.iter().any(|attr| {
13941394
attr.name.local == local_name!("shadowrootmode")
1395-
&& (attr.value.to_string() == String::from("open") || attr.value.to_string() == String::from("close"))
1395+
&& (attr.value.to_string() == *"open" || attr.value.to_string() == *"close")
13961396
});
13971397

13981398
// Check if intended_parent's document allows declarative shadow roots
1399-
let allow_declarative_shadow_roots = self.sink.allow_declarative_shadow_roots(&intended_parent);
1399+
let allow_declarative_shadow_roots =
1400+
self.sink.allow_declarative_shadow_roots(&intended_parent);
14001401

14011402
// the adjusted current node is not the topmost element in the stack of open elements
14021403
let adjusted_current_node_not_topmost = match self.open_elems.borrow().first() {
@@ -1412,11 +1413,12 @@ where
14121413
None => true,
14131414
};
14141415

1415-
return is_shadow_root_mode && allow_declarative_shadow_roots && adjusted_current_node_not_topmost;
1416+
is_shadow_root_mode && allow_declarative_shadow_roots && adjusted_current_node_not_topmost
14161417
}
14171418

14181419
fn attach_declarative_shadow(&self, tag: &Tag) -> Result<(), String> {
1419-
self.sink.attach_declarative_shadow(self.open_elems.borrow().last().unwrap(), tag.attrs.clone())
1420+
self.sink
1421+
.attach_declarative_shadow(self.open_elems.borrow().last().unwrap(), tag.attrs.clone())
14201422
}
14211423

14221424
fn create_formatting_element_for(&self, tag: Tag) -> Handle {

html5ever/src/tree_builder/rules.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ where
160160
self.template_modes.borrow_mut().push(InTemplate);
161161

162162
if (self.should_attach_declarative_shadow(&tag)) {
163-
if let Err(_) = self.attach_declarative_shadow(&tag) {
163+
if self.attach_declarative_shadow(&tag).is_err() {
164164
// TODO:
165165
// insert at the adjusted insertion location
166166
// with the result of insert a foreign element for template tag

markup5ever/entities.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pub const NAMED_ENTITIES: [(&str, u32, u32); 2231] = [
1+
pub static NAMED_ENTITIES: [(&str, u32, u32); 2231] = [
22
("&Aacute;", 193, 0),
33
("&Aacute", 193, 0),
44
("&aacute;", 225, 0),

markup5ever/interface/tree_builder.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ pub trait TreeSink {
262262
}
263263

264264
fn allow_declarative_shadow_roots(&self, _intended_parent: &Self::Handle) -> bool {
265-
return true;
265+
true
266266
}
267267

268268
/// Attach declarative shadow
@@ -271,7 +271,9 @@ pub trait TreeSink {
271271
_location: &Self::Handle,
272272
_attrs: Vec<Attribute>,
273273
) -> Result<(), String> {
274-
Err(String::from("No implementation for attach_declarative_shadow"))
274+
Err(String::from(
275+
"No implementation for attach_declarative_shadow",
276+
))
275277
}
276278
}
277279

match_token/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
syn = "2"
7+
syn = { version = "2", features = ["full"] }
88
quote = "1"
99
proc-macro2 = "1"
1010

1111
[lib]
12-
proc-macro = true
12+
proc-macro = true

0 commit comments

Comments
 (0)