File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,7 @@ macro_rules! user_output {
9494
9595/// All of the available subcommands for `cargo gpu`
9696#[ derive( clap:: Subcommand ) ]
97+ #[ non_exhaustive]
9798pub enum Command {
9899 /// Install rust-gpu compiler artifacts.
99100 Install ( Box < Install > ) ,
@@ -112,7 +113,11 @@ pub enum Command {
112113}
113114
114115impl Command {
115- /// run the command
116+ /// Runs the command
117+ ///
118+ /// # Errors
119+ /// Any errors during execution, usually printed to the user
120+ #[ inline]
116121 pub fn run ( & self , env_args : Vec < String > ) -> anyhow:: Result < ( ) > {
117122 match & self {
118123 Self :: Install ( install) => {
@@ -152,13 +157,18 @@ impl Command {
152157/// the Cli struct representing the main cli
153158#[ derive( clap:: Parser ) ]
154159#[ clap( author, version, about, subcommand_required = true ) ]
160+ #[ non_exhaustive]
155161pub struct Cli {
156162 /// The command to run.
157163 #[ clap( subcommand) ]
158164 pub command : Command ,
159165}
160166
161167/// The central cache directory of cargo gpu
168+ ///
169+ /// # Errors
170+ /// may fail if we can't find the user home directory
171+ #[ inline]
162172pub fn cache_dir ( ) -> anyhow:: Result < std:: path:: PathBuf > {
163173 let dir = directories:: BaseDirs :: new ( )
164174 . with_context ( || "could not find the user home directory" ) ?
Original file line number Diff line number Diff line change 11//! main executable of cargo gpu
22use cargo_gpu:: Cli ;
3- use clap:: Parser ;
3+ use clap:: Parser as _ ;
44
55fn main ( ) {
66 #[ cfg( debug_assertions) ]
@@ -27,7 +27,7 @@ fn main() {
2727}
2828
2929/// Wrappable "main" to catch errors.
30- pub fn run ( ) -> anyhow:: Result < ( ) > {
30+ fn run ( ) -> anyhow:: Result < ( ) > {
3131 let env_args = std:: env:: args ( )
3232 . filter ( |arg| {
3333 // Calling our `main()` with the cargo subcommand `cargo gpu` passes "gpu"
You can’t perform that action at this time.
0 commit comments