mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-27 07:46:29 +00:00
Make everything static
This commit is contained in:
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"),
|
path: concat!(#dir_path, "/README.md"),
|
||||||
content: ::std::include_bytes!(concat!("../", #dir_path, "/README.md")),
|
content: ::std::include_bytes!(concat!("../", #dir_path, "/README.md")),
|
||||||
},
|
},
|
||||||
content: vec![
|
content: &[
|
||||||
#(EmbeddedFile {
|
#(EmbeddedFile {
|
||||||
path: #dir_files,
|
path: #dir_files,
|
||||||
content: ::std::include_bytes!(concat!("../", #dir_files)),
|
content: ::std::include_bytes!(concat!("../", #dir_files)),
|
||||||
|
@ -81,13 +81,13 @@ pub fn include_files(_: TokenStream) -> TokenStream {
|
||||||
path: "exercises/README.md",
|
path: "exercises/README.md",
|
||||||
content: ::std::include_bytes!("../exercises/README.md"),
|
content: ::std::include_bytes!("../exercises/README.md"),
|
||||||
},
|
},
|
||||||
files: vec![#(
|
files: &[#(
|
||||||
EmbeddedFile {
|
EmbeddedFile {
|
||||||
path: #files,
|
path: #files,
|
||||||
content: ::std::include_bytes!(concat!("../", #files)),
|
content: ::std::include_bytes!(concat!("../", #files)),
|
||||||
}
|
}
|
||||||
),*],
|
),*],
|
||||||
dirs: vec![#(#dirs),*],
|
dirs: &[#(#dirs),*],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,13 +35,13 @@ struct EmbeddedFile {
|
||||||
struct EmbeddedFlatDir {
|
struct EmbeddedFlatDir {
|
||||||
path: &'static str,
|
path: &'static str,
|
||||||
readme: EmbeddedFile,
|
readme: EmbeddedFile,
|
||||||
content: Vec<EmbeddedFile>,
|
content: &'static [EmbeddedFile],
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ExercisesDir {
|
struct ExercisesDir {
|
||||||
readme: EmbeddedFile,
|
readme: EmbeddedFile,
|
||||||
files: Vec<EmbeddedFile>,
|
files: &'static [EmbeddedFile],
|
||||||
dirs: Vec<EmbeddedFlatDir>,
|
dirs: &'static [EmbeddedFlatDir],
|
||||||
}
|
}
|
||||||
|
|
||||||
struct EmbeddedFiles {
|
struct EmbeddedFiles {
|
||||||
|
@ -49,6 +49,8 @@ struct EmbeddedFiles {
|
||||||
exercises_dir: ExercisesDir,
|
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
|
/// Rustlings is a collection of small exercises to get you used to writing and reading Rust code
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[command(version)]
|
#[command(version)]
|
||||||
|
@ -109,7 +111,6 @@ enum Subcommands {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
let embedded_files = rustlings_macros::include_files!();
|
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
|
|
||||||
if args.command.is_none() {
|
if args.command.is_none() {
|
||||||
|
|
Loading…
Reference in a new issue