diff --git a/Cargo.toml b/Cargo.toml index 019c08ec..bfd79f23 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -137,3 +137,7 @@ required-features = ["std"] [[example]] name = "io" required-features = ["std"] + +[[example]] +name = "foo" +required-features = ["std"] diff --git a/examples/foo.rs b/examples/foo.rs index cb628d1b..ae58e43a 100644 --- a/examples/foo.rs +++ b/examples/foo.rs @@ -180,7 +180,8 @@ fn eval<'a>( } fn main() { - let src = std::fs::read_to_string(std::env::args().nth(1).unwrap()).unwrap(); + let usage = "Run `cargo run --example foo -- examples/sample.foo`"; + let src = std::fs::read_to_string(std::env::args().nth(1).expect(usage)).expect(usage); match parser().parse(&src).into_result() { Ok(ast) => match eval(&ast, &mut Vec::new(), &mut Vec::new()) {