fmt: always forget about fmt

This commit is contained in:
Yiffy Dev 2024-11-02 00:34:03 +05:00 • committed by spushk
commit f4827a4902
Signed by: spushk
GPG key ID: 7797B761E105E8AA
3 changed files with 11 additions and 13 deletions

View file

@ -109,19 +109,22 @@ impl Debug for SabryCompilerError {
Self::LightPrint(e) => format!( Self::LightPrint(e) => format!(
"{} at {:?}", "{} at {:?}",
e.kind, e.kind,
e.loc.clone() e.loc
.clone()
.map(|l| format!("file {}, line {}, col {}", l.filename, l.line, l.column)) .map(|l| format!("file {}, line {}, col {}", l.filename, l.line, l.column))
), ),
Self::GrassCompile(err) => format!("{err}"), Self::GrassCompile(err) => format!("{err}"),
Self::LightMinify(e) => format!( Self::LightMinify(e) => format!(
"{} at {:?}", "{} at {:?}",
e.kind, e.kind,
e.loc.clone() e.loc
.clone()
.map(|l| format!("file {}, line {}, col {}", l.filename, l.line, l.column)) .map(|l| format!("file {}, line {}, col {}", l.filename, l.line, l.column))
), ),
Self::LightParse { kind, loc } => format!( Self::LightParse { kind, loc } => format!(
"{kind} at {:?}", "{kind} at {:?}",
loc.clone().map(|l| format!("file {}, line {}, col {}", l.filename, l.line, l.column)) loc.clone()
.map(|l| format!("file {}, line {}, col {}", l.filename, l.line, l.column))
), ),
}; };

View file

@ -18,7 +18,7 @@ pub enum ScopeError {
impl Debug for ScopeError { impl Debug for ScopeError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let a = match self { let a = match self {
Self::Raffia(kind, source) => format!("{kind}: at {source}") Self::Raffia(kind, source) => format!("{kind}: at {source}"),
}; };
write!(f, "{a}") write!(f, "{a}")
@ -43,14 +43,11 @@ impl<'s> ArbitraryScope<'s> {
Ok(a) => a, Ok(a) => a,
Err(e) => { Err(e) => {
let source = &source[e.span.start..e.span.end]; let source = &source[e.span.start..e.span.end];
return Err(ScopeError::Raffia(e.kind, source.to_string())) return Err(ScopeError::Raffia(e.kind, source.to_string()));
} }
}; };
Ok(Self { Ok(Self { adapter, name })
adapter,
name,
})
} }
/// Consume arbitrary scope and create a [HashedScope] in its basis /// Consume arbitrary scope and create a [HashedScope] in its basis

View file

@ -23,10 +23,8 @@ pub fn sassy_macro_impl(input: TokenStream) -> TokenStream {
// quick raffia syntax check // quick raffia syntax check
match ArbitraryScope::from_source(mode.into(), ident.clone(), &code.code) { match ArbitraryScope::from_source(mode.into(), ident.clone(), &code.code) {
Ok(_) => {}, Ok(_) => {}
Err(e) => { Err(e) => return syn::Error::new(code.span, format!("{e:?}")).into_compile_error(),
return syn::Error::new(code.span, format!("{e:?}")).into_compile_error()
}
} }
let sourcesass = code.to_string(); let sourcesass = code.to_string();