1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-11-08 09:09:17 +01:00

Make everything static

This commit is contained in:
mo8it 2024-03-28 17:52:51 +01:00
parent e5efc68a91
commit dd025391f2
2 changed files with 8 additions and 7 deletions

@ -63,7 +63,7 @@ pub fn include_files(_: TokenStream) -> TokenStream {
path: concat!(#dir_path, "/README.md"),
content: ::std::include_bytes!(concat!("../", #dir_path, "/README.md")),
},
content: vec![
content: &[
#(EmbeddedFile {
path: #dir_files,
content: ::std::include_bytes!(concat!("../", #dir_files)),
@ -81,13 +81,13 @@ pub fn include_files(_: TokenStream) -> TokenStream {
path: "exercises/README.md",
content: ::std::include_bytes!("../exercises/README.md"),
},
files: vec![#(
files: &[#(
EmbeddedFile {
path: #files,
content: ::std::include_bytes!(concat!("../", #files)),
}
),*],
dirs: vec![#(#dirs),*],
dirs: &[#(#dirs),*],
},
}
}

@ -35,13 +35,13 @@ struct EmbeddedFile {
struct EmbeddedFlatDir {
path: &'static str,
readme: EmbeddedFile,
content: Vec<EmbeddedFile>,
content: &'static [EmbeddedFile],
}
struct ExercisesDir {
readme: EmbeddedFile,
files: Vec<EmbeddedFile>,
dirs: Vec<EmbeddedFlatDir>,
files: &'static [EmbeddedFile],
dirs: &'static [EmbeddedFlatDir],
}
struct EmbeddedFiles {
@ -49,6 +49,8 @@ struct EmbeddedFiles {
exercises_dir: ExercisesDir,
}
static EMBEDDED_FILES: EmbeddedFiles = rustlings_macros::include_files!();
/// Rustlings is a collection of small exercises to get you used to writing and reading Rust code
#[derive(Parser)]
#[command(version)]
@ -109,7 +111,6 @@ enum Subcommands {
}
fn main() -> Result<()> {
let embedded_files = rustlings_macros::include_files!();
let args = Args::parse();
if args.command.is_none() {