Skip to content

Commit 46ba9d5

Browse files
committed
fix clippy warnings
1 parent 270e0e5 commit 46ba9d5

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

crates/cargo-gpu/src/lib.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff 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]
9798
pub enum Command {
9899
/// Install rust-gpu compiler artifacts.
99100
Install(Box<Install>),
@@ -112,7 +113,11 @@ pub enum Command {
112113
}
113114

114115
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]
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]
155161
pub 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]
162172
pub fn cache_dir() -> anyhow::Result<std::path::PathBuf> {
163173
let dir = directories::BaseDirs::new()
164174
.with_context(|| "could not find the user home directory")?

crates/cargo-gpu/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! main executable of cargo gpu
22
use cargo_gpu::Cli;
3-
use clap::Parser;
3+
use clap::Parser as _;
44

55
fn 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"

0 commit comments

Comments
 (0)