mirror of
https://git.aramjonghu.dev/AramJonghu/rustlings.git
synced 2026-09-04 17:23:36 +02:00
Remove \r on Windows
This commit is contained in:
@@ -16,8 +16,16 @@ struct InfoFile<'a> {
|
||||
|
||||
#[proc_macro]
|
||||
pub fn include_files(_: TokenStream) -> TokenStream {
|
||||
let info_file = include_str!("../info.toml");
|
||||
let exercises = toml::de::from_str::<InfoFile>(info_file)
|
||||
// Remove `\r` on Windows
|
||||
let info_file = String::from_utf8(
|
||||
include_bytes!("../info.toml")
|
||||
.iter()
|
||||
.copied()
|
||||
.filter(|c| *c != b'\r')
|
||||
.collect(),
|
||||
)
|
||||
.expect("Failed to parse `info.toml` as UTF8");
|
||||
let exercises = toml::de::from_str::<InfoFile>(&info_file)
|
||||
.expect("Failed to parse `info.toml`")
|
||||
.exercises;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user