Skip to content

Commit 251061b

Browse files
committed
cargo-gpu merge: fix docs and clippy
1 parent 508ce14 commit 251061b

4 files changed

Lines changed: 14 additions & 9 deletions

File tree

crates/cargo-gpu-install/src/install.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ pub struct Install {
8080
clippy::doc_markdown,
8181
reason = "The URL should appear literally like this. But Clippy wants a markdown clickable link"
8282
)]
83+
#[expect(rustdoc::bare_urls)]
8384
/// Source of `spirv-builder` dependency
8485
/// Eg: "https://github.com/Rust-GPU/rust-gpu"
8586
#[cfg_attr(feature = "clap", clap(long))]

crates/cargo-gpu-install/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
#![expect(clippy::pub_use, reason = "pub use for build scripts")]
2-
#![expect(
3-
missing_docs,
4-
clippy::missing_docs_in_private_items,
5-
reason = "crate docs are cfg'ed out"
6-
)]
2+
#![expect(missing_docs, reason = "crate docs are cfg'ed out")]
73
#![cfg_attr(doc, doc = include_str!("../README.md"))]
84

95
pub mod install;

crates/cargo-gpu-install/src/spirv_source.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use std::path::{Path, PathBuf};
1515
clippy::doc_markdown,
1616
reason = "The URL should appear literally like this. But Clippy wants a markdown clickable link"
1717
)]
18+
#[expect(rustdoc::bare_urls)]
1819
/// The source and version of `rust-gpu`.
1920
/// Eg:
2021
/// * From crates.io with version "0.10.0"

crates/cargo-gpu-install/src/test.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ impl TestEnv {
3939
}
4040

4141
/// Copies the `shader_crate_template` to the temp dir and returns the path to the directory.
42+
#[expect(clippy::unused_self)]
4243
pub fn setup_shader_crate(&self) -> anyhow::Result<PathBuf> {
43-
let shader_crate_path = crate::cache_dir().unwrap().join("shader_crate");
44+
let shader_crate_path = crate::cache_dir()?.join("shader_crate");
4445
copy_dir_all(shader_crate_template_path(), &shader_crate_path)?;
4546
Ok(shader_crate_path)
4647
}
@@ -65,6 +66,12 @@ impl TestEnv {
6566
}
6667
}
6768

69+
impl Default for TestEnv {
70+
fn default() -> Self {
71+
Self::new()
72+
}
73+
}
74+
6875
impl Drop for TestEnv {
6976
fn drop(&mut self) {
7077
TESTDIR.replace(None).unwrap();
@@ -76,14 +83,14 @@ impl Drop for TestEnv {
7683
}
7784

7885
thread_local! {
79-
static TESTDIR: RefCell<Option<PathBuf>> = RefCell::new(None);
86+
static TESTDIR: RefCell<Option<PathBuf>> = const { RefCell::new(None) };
8087
}
8188

8289
/// [`crate::cache_dir`] for testing, see [`TestEnv`]
8390
pub fn test_cache_dir() -> anyhow::Result<PathBuf> {
84-
Ok(TESTDIR.with_borrow(|a| a.clone()).context(
91+
TESTDIR.with_borrow(|a| a.clone()).context(
8592
"TestEnv is not initialized! Add `let _env = TestEnv::new();` to the beginning of your test",
86-
)?)
93+
)
8794
}
8895

8996
fn copy_dir_all(

0 commit comments

Comments
 (0)