cargo-script icon indicating copy to clipboard operation
cargo-script copied to clipboard

Ability to omit `fn main()`

Open paulkernfeld opened this issue 7 years ago • 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.

paulkernfeld avatar Nov 25 '18 15:11 paulkernfeld