Skip to content

Commit 7351ea7

Browse files
committed
chore: Restrict visibility of items in parser.rs
1 parent 882dd0e commit 7351ea7

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
- `CSSInliner::options()` that implements the Builder pattern. [#71](https://github.com/Stranger6667/css-inline/issues/71)
88

9+
### Changed
10+
11+
- Restrict visibility of items in `parser.rs`
12+
913
### Performance
1014

1115
- Avoid string allocation in `get_full_url`

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
missing_debug_implementations,
9797
trivial_casts,
9898
trivial_numeric_casts,
99+
unreachable_pub,
99100
unused_extern_crates,
100101
unused_import_braces,
101102
unused_qualifications,

src/parser.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use kuchiki::Selectors;
22

3-
pub struct CSSRuleListParser;
3+
pub(crate) struct CSSRuleListParser;
44
pub(crate) struct CSSDeclarationListParser;
55

6-
pub type Declaration<'i> = (cssparser::CowRcStr<'i>, &'i str);
7-
pub type QualifiedRule<'i> = (&'i str, Vec<Declaration<'i>>);
6+
pub(crate) type Declaration<'i> = (cssparser::CowRcStr<'i>, &'i str);
7+
pub(crate) type QualifiedRule<'i> = (&'i str, Vec<Declaration<'i>>);
88

99
#[derive(Debug)]
1010
pub(crate) struct Rule<'i> {
@@ -14,7 +14,7 @@ pub(crate) struct Rule<'i> {
1414

1515
impl<'i> Rule<'i> {
1616
#[inline]
17-
pub fn new(selectors: &str, declarations: Vec<Declaration<'i>>) -> Result<Rule<'i>, ()> {
17+
pub(crate) fn new(selectors: &str, declarations: Vec<Declaration<'i>>) -> Result<Rule<'i>, ()> {
1818
Ok(Rule {
1919
selectors: Selectors::compile(selectors)?,
2020
declarations,
@@ -94,20 +94,22 @@ impl<'i> cssparser::AtRuleParser<'i> for CSSDeclarationListParser {
9494
type Error = ();
9595
}
9696

97-
pub struct CSSParser<'i, 't> {
97+
pub(crate) struct CSSParser<'i, 't> {
9898
input: cssparser::Parser<'i, 't>,
9999
}
100100

101101
impl<'i: 't, 't> CSSParser<'i, 't> {
102102
#[inline]
103-
pub fn new(css: &'t mut cssparser::ParserInput<'i>) -> CSSParser<'i, 't> {
103+
pub(crate) fn new(css: &'t mut cssparser::ParserInput<'i>) -> CSSParser<'i, 't> {
104104
CSSParser {
105105
input: cssparser::Parser::new(css),
106106
}
107107
}
108108

109109
#[inline]
110-
pub fn parse<'a>(&'a mut self) -> cssparser::RuleListParser<'i, 't, 'a, CSSRuleListParser> {
110+
pub(crate) fn parse<'a>(
111+
&'a mut self,
112+
) -> cssparser::RuleListParser<'i, 't, 'a, CSSRuleListParser> {
111113
cssparser::RuleListParser::new_for_stylesheet(&mut self.input, CSSRuleListParser)
112114
}
113115
}

0 commit comments

Comments
 (0)