clippy
This commit is contained in:
parent
1cd38f0317
commit
2efdf489ca
@ -44,6 +44,7 @@ impl From<FromUtf8Error> for SassError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl From<SassError> for String {
|
impl From<SassError> for String {
|
||||||
|
#[inline]
|
||||||
fn from(error: SassError) -> String {
|
fn from(error: SassError) -> String {
|
||||||
error.message
|
error.message
|
||||||
}
|
}
|
||||||
|
@ -117,6 +117,7 @@ pub enum TokenKind {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Display for TokenKind {
|
impl Display for TokenKind {
|
||||||
|
#[inline]
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
TokenKind::Ident(s) | TokenKind::Number(s) => write!(f, "{}", s),
|
TokenKind::Ident(s) | TokenKind::Number(s) => write!(f, "{}", s),
|
||||||
@ -194,6 +195,7 @@ enum Expr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl StyleSheet {
|
impl StyleSheet {
|
||||||
|
#[inline]
|
||||||
pub fn new(input: &str) -> SassResult<StyleSheet> {
|
pub fn new(input: &str) -> SassResult<StyleSheet> {
|
||||||
Ok(StyleSheet(
|
Ok(StyleSheet(
|
||||||
StyleSheetParser {
|
StyleSheetParser {
|
||||||
@ -208,13 +210,12 @@ impl StyleSheet {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
pub fn from_path<P: AsRef<Path> + Into<String>>(p: P) -> SassResult<StyleSheet> {
|
pub fn from_path<P: AsRef<Path> + Into<String>>(p: P) -> SassResult<StyleSheet> {
|
||||||
let s = String::from_utf8(fs::read(p.as_ref())?)?;
|
|
||||||
dbg!(&s);
|
|
||||||
Ok(StyleSheet(
|
Ok(StyleSheet(
|
||||||
StyleSheetParser {
|
StyleSheetParser {
|
||||||
global_scope: Scope::new(),
|
global_scope: Scope::new(),
|
||||||
lexer: Lexer::new(&s).peekable(),
|
lexer: Lexer::new(&String::from_utf8(fs::read(p.as_ref())?)?).peekable(),
|
||||||
rules: Vec::new(),
|
rules: Vec::new(),
|
||||||
scope: 0,
|
scope: 0,
|
||||||
file: p.into(),
|
file: p.into(),
|
||||||
@ -243,6 +244,7 @@ impl StyleSheet {
|
|||||||
/// to pure CSS
|
/// to pure CSS
|
||||||
///
|
///
|
||||||
/// Used mainly in debugging, but can at times be useful
|
/// Used mainly in debugging, but can at times be useful
|
||||||
|
#[inline]
|
||||||
pub fn pretty_print<W: Write>(&self, buf: W) -> SassResult<()> {
|
pub fn pretty_print<W: Write>(&self, buf: W) -> SassResult<()> {
|
||||||
PrettyPrinter::new(buf).pretty_print(self)
|
PrettyPrinter::new(buf).pretty_print(self)
|
||||||
}
|
}
|
||||||
@ -253,6 +255,7 @@ impl StyleSheet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Write the internal representation as CSS to `buf`
|
/// Write the internal representation as CSS to `buf`
|
||||||
|
#[inline]
|
||||||
pub fn print_as_css<W: Write>(self, buf: &mut W) -> SassResult<()> {
|
pub fn print_as_css<W: Write>(self, buf: &mut W) -> SassResult<()> {
|
||||||
Css::from_stylesheet(self).pretty_print(buf)
|
Css::from_stylesheet(self).pretty_print(buf)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user