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 {
94
94
95
95
/// All of the available subcommands for `cargo gpu`
96
96
#[ derive( clap:: Subcommand ) ]
97
+ #[ non_exhaustive]
97
98
pub enum Command {
98
99
/// Install rust-gpu compiler artifacts.
99
100
Install ( Box < Install > ) ,
@@ -112,7 +113,11 @@ pub enum Command {
112
113
}
113
114
114
115
impl Command {
115
- /// run the command
116
+ /// Runs the command
117
+ ///
118
+ /// # Errors
119
+ /// Any errors during execution, usually printed to the user
120
+ #[ inline]
116
121
pub fn run ( & self , env_args : Vec < String > ) -> anyhow:: Result < ( ) > {
117
122
match & self {
118
123
Self :: Install ( install) => {
@@ -152,13 +157,18 @@ impl Command {
152
157
/// the Cli struct representing the main cli
153
158
#[ derive( clap:: Parser ) ]
154
159
#[ clap( author, version, about, subcommand_required = true ) ]
160
+ #[ non_exhaustive]
155
161
pub struct Cli {
156
162
/// The command to run.
157
163
#[ clap( subcommand) ]
158
164
pub command : Command ,
159
165
}
160
166
161
167
/// The central cache directory of cargo gpu
168
+ ///
169
+ /// # Errors
170
+ /// may fail if we can't find the user home directory
171
+ #[ inline]
162
172
pub fn cache_dir ( ) -> anyhow:: Result < std:: path:: PathBuf > {
163
173
let dir = directories:: BaseDirs :: new ( )
164
174
. with_context ( || "could not find the user home directory" ) ?
Original file line number Diff line number Diff line change 1
1
//! main executable of cargo gpu
2
2
use cargo_gpu:: Cli ;
3
- use clap:: Parser ;
3
+ use clap:: Parser as _ ;
4
4
5
5
fn main ( ) {
6
6
#[ cfg( debug_assertions) ]
@@ -27,7 +27,7 @@ fn main() {
27
27
}
28
28
29
29
/// Wrappable "main" to catch errors.
30
- pub fn run ( ) -> anyhow:: Result < ( ) > {
30
+ fn run ( ) -> anyhow:: Result < ( ) > {
31
31
let env_args = std:: env:: args ( )
32
32
. filter ( |arg| {
33
33
// Calling our `main()` with the cargo subcommand `cargo gpu` passes "gpu"
You can’t perform that action at this time.
0 commit comments