This commit is contained in:
Connor Skees 2022-12-26 19:11:36 -05:00
parent 31bbe8f60f
commit 10059daad9

View File

@ -107,7 +107,11 @@ fn raw_to_parse_error(map: &CodeMap, err: Error, unicode: bool) -> Box<Error> {
Box::new(Error::from_loc(message, map.look_up_span(span), unicode))
}
fn from_string_with_file_name<P: AsRef<Path>>(input: String, file_name: P, options: &Options) -> Result<String> {
fn from_string_with_file_name<P: AsRef<Path>>(
input: String,
file_name: P,
options: &Options,
) -> Result<String> {
let mut map = CodeMap::new();
let path = file_name.as_ref();
let file = map.add_file(path.to_string_lossy().into_owned(), input);
@ -178,11 +182,7 @@ fn from_string_with_file_name<P: AsRef<Path>>(input: String, file_name: P, optio
#[inline]
pub fn from_path<P: AsRef<Path>>(p: P, options: &Options) -> Result<String> {
from_string_with_file_name(
String::from_utf8(options.fs.read(p.as_ref())?)?,
p,
options,
)
from_string_with_file_name(String::from_utf8(options.fs.read(p.as_ref())?)?, p, options)
}
/// Compile CSS from a string