1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-09-16 10:51:42 +02:00

Don't be lazy, actually read the file instead of including it at compile time

This commit is contained in:
Carol (Nichols || Goulding) 2018-03-04 14:13:55 -05:00
parent 70aa18699b
commit 426e5cf3f5
No known key found for this signature in database
GPG Key ID: D04B39A6CA243902

View File

@ -18,7 +18,10 @@ use std::io::prelude::*;
use std::path::PathBuf;
fn main() {
let template = include_str!("../../README-template.hbs");
let mut template_file = File::open("README-template.hbs").unwrap();
let mut template = String::new();
template_file.read_to_string(&mut template).unwrap();
let autogenerated_notice = "This file was autogenerated by the script in src/bin/generate_readme.rs.
Please edit either the script or the template in README-template.md in
order to make changes here rather than committing the changes directly.";
@ -32,7 +35,7 @@ order to make changes here rather than committing the changes directly.";
generated_readme,
"{}",
hbs.render_template(
template,
&template,
&json!({ "autogenerated_notice": autogenerated_notice }),
).unwrap()
).unwrap();