DanielKeep/cargo-script

Ability to omit `fn main()`

paulkernfeld opened this issue · 0 comments

It would be nice to be able to write a script like:

#!/usr/bin/env run-cargo-script
println!("1 + 1 = {}", 1 + 1);

Rust's doctests currently support the ability to omit fn main. If I'm looking at the right part of the source code, they parse the code and detect whether there is already a function named main.