Skip to content

Commit

Permalink
Merge pull request #604 from sshine/sshine/foo-example-usage
Browse files Browse the repository at this point in the history
fix(examples/foo): Add to Cargo.toml and .expect() with usage
  • Loading branch information
zesterer authored Feb 20, 2024
2 parents 189cff7 + c46d8f3 commit 7678d7f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,7 @@ required-features = ["std"]
[[example]]
name = "io"
required-features = ["std"]

[[example]]
name = "foo"
required-features = ["std"]
3 changes: 2 additions & 1 deletion examples/foo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit 7678d7f

Please sign in to comment.