Skip to content

Commit c39c189

Browse files
committed
chore: Remove redundant struct
1 parent 7351ea7 commit c39c189

File tree

2 files changed

+6
-24
lines changed

2 files changed

+6
-24
lines changed

src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,10 @@ impl<'a> CSSInliner<'a> {
339339

340340
fn process_css(document: &NodeRef, css: &str) -> Result<()> {
341341
let mut parse_input = cssparser::ParserInput::new(css);
342-
let mut parser = parser::CSSParser::new(&mut parse_input);
343-
for parsed in parser.parse() {
342+
let mut parser = cssparser::Parser::new(&mut parse_input);
343+
let rule_list =
344+
cssparser::RuleListParser::new_for_stylesheet(&mut parser, parser::CSSRuleListParser);
345+
for parsed in rule_list {
344346
if let Ok((selector, declarations)) = parsed {
345347
if let Ok(rule) = Rule::new(selector, declarations) {
346348
let matching_elements = document

src/parser.rs

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ impl<'i> cssparser::DeclarationParser<'i> for CSSDeclarationListParser {
7979
}
8080

8181
impl<'i> cssparser::AtRuleParser<'i> for CSSRuleListParser {
82-
type PreludeNoBlock = String;
83-
type PreludeBlock = String;
82+
type PreludeNoBlock = &'i str;
83+
type PreludeBlock = &'i str;
8484
type AtRule = QualifiedRule<'i>;
8585
type Error = ();
8686
}
@@ -93,23 +93,3 @@ impl<'i> cssparser::AtRuleParser<'i> for CSSDeclarationListParser {
9393
type AtRule = Declaration<'i>;
9494
type Error = ();
9595
}
96-
97-
pub(crate) struct CSSParser<'i, 't> {
98-
input: cssparser::Parser<'i, 't>,
99-
}
100-
101-
impl<'i: 't, 't> CSSParser<'i, 't> {
102-
#[inline]
103-
pub(crate) fn new(css: &'t mut cssparser::ParserInput<'i>) -> CSSParser<'i, 't> {
104-
CSSParser {
105-
input: cssparser::Parser::new(css),
106-
}
107-
}
108-
109-
#[inline]
110-
pub(crate) fn parse<'a>(
111-
&'a mut self,
112-
) -> cssparser::RuleListParser<'i, 't, 'a, CSSRuleListParser> {
113-
cssparser::RuleListParser::new_for_stylesheet(&mut self.input, CSSRuleListParser)
114-
}
115-
}

0 commit comments

Comments
 (0)