Skip to content

Commit 9a53d25

Browse files
committed
Fix clippy lints
1 parent bfc332a commit 9a53d25

File tree

23 files changed

+37
-54
lines changed

23 files changed

+37
-54
lines changed

examples/lifetime/src/main.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,30 @@
22

33
use lifetime::{kernel, link};
44

5-
fn main() -> rust_cuda::deps::rustacuda::error::CudaResult<()> {
5+
fn main() -> rust_cuda::deps::cust::error::CudaResult<()> {
66
// Link the lifetime-only-generic CUDA kernel
77
struct KernelPtx<'a, 'b>(core::marker::PhantomData<(&'a (), &'b ())>);
88
link! { impl kernel<'a, 'b> for KernelPtx }
99

1010
// Initialize the CUDA API
11-
rust_cuda::deps::rustacuda::init(rust_cuda::deps::rustacuda::CudaFlags::empty())?;
11+
rust_cuda::deps::cust::init(rust_cuda::deps::cust::CudaFlags::empty())?;
1212

1313
// Get the first CUDA GPU device
14-
let device = rust_cuda::deps::rustacuda::device::Device::get_device(0)?;
14+
let device = rust_cuda::deps::cust::device::Device::get_device(0)?;
1515

1616
// Create a CUDA context associated to this device
1717
let _context = rust_cuda::host::CudaDropWrapper::from(
18-
rust_cuda::deps::rustacuda::context::Context::create_and_push(
19-
rust_cuda::deps::rustacuda::context::ContextFlags::MAP_HOST
20-
| rust_cuda::deps::rustacuda::context::ContextFlags::SCHED_AUTO,
18+
rust_cuda::deps::cust::context::legacy::Context::create_and_push(
19+
rust_cuda::deps::cust::context::legacy::ContextFlags::MAP_HOST
20+
| rust_cuda::deps::cust::context::legacy::ContextFlags::SCHED_AUTO,
2121
device,
2222
)?,
2323
);
2424

2525
// Create a new CUDA stream to submit kernels to
2626
let mut stream =
27-
rust_cuda::host::CudaDropWrapper::from(rust_cuda::deps::rustacuda::stream::Stream::new(
28-
rust_cuda::deps::rustacuda::stream::StreamFlags::NON_BLOCKING,
27+
rust_cuda::host::CudaDropWrapper::from(rust_cuda::deps::cust::stream::Stream::new(
28+
rust_cuda::deps::cust::stream::StreamFlags::NON_BLOCKING,
2929
None,
3030
)?);
3131

@@ -34,8 +34,8 @@ fn main() -> rust_cuda::deps::rustacuda::error::CudaResult<()> {
3434
// Create a new instance of the CUDA kernel and prepare the launch config
3535
let mut kernel = rust_cuda::kernel::TypedPtxKernel::<kernel>::new::<KernelPtx>(None);
3636
let config = rust_cuda::kernel::LaunchConfig {
37-
grid: rust_cuda::deps::rustacuda::function::GridSize::x(1),
38-
block: rust_cuda::deps::rustacuda::function::BlockSize::x(4),
37+
grid: rust_cuda::deps::cust::function::GridSize::x(1),
38+
block: rust_cuda::deps::cust::function::BlockSize::x(4),
3939
ptx_jit: false,
4040
};
4141

rust-cuda-derive/src/rust_to_cuda/field_ty.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use syn::{parse_quote, spanned::Spanned};
22

3-
#[expect(clippy::module_name_repetitions)]
43
pub enum CudaReprFieldTy {
54
SafeDeviceCopy,
65
RustToCuda {

rust-cuda-derive/src/rust_to_cuda/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn get_cuda_repr_ident(rust_repr_ident: &proc_macro2::Ident) -> proc_macro2::Ide
1010
format_ident!("{}CudaRepresentation", rust_repr_ident)
1111
}
1212

13-
#[expect(clippy::module_name_repetitions, clippy::too_many_lines)]
13+
#[expect(clippy::too_many_lines)]
1414
pub fn impl_rust_to_cuda(ast: &syn::DeriveInput) -> proc_macro::TokenStream {
1515
let (mut struct_fields_cuda, struct_semi_cuda) = if let syn::Data::Struct(s) = &ast.data {
1616
(s.fields.clone(), s.semi_token)

rust-cuda-kernel/src/kernel/link/mod.rs

+22-10
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@ fn check_kernel_ptx_and_report(
321321
Ok(None) => (),
322322
Ok(Some(binary)) => {
323323
if ptx_lint_levels
324-
.get(&PtxLint::DumpAssembly).is_some_and(|level| *level > LintLevel::Allow)
324+
.get(&PtxLint::DumpAssembly)
325+
.is_some_and(|level| *level > LintLevel::Allow)
325326
{
326327
const HEX: [char; 16] = [
327328
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
@@ -335,7 +336,8 @@ fn check_kernel_ptx_and_report(
335336
}
336337

337338
if ptx_lint_levels
338-
.get(&PtxLint::DumpAssembly).is_some_and(|level| *level > LintLevel::Warn)
339+
.get(&PtxLint::DumpAssembly)
340+
.is_some_and(|level| *level > LintLevel::Warn)
339341
{
340342
emit_call_site_error!(
341343
"{} compiled binary:\n{}\n\n{}",
@@ -457,22 +459,27 @@ fn check_kernel_ptx(
457459
let mut options = options.clone();
458460

459461
if ptx_lint_levels
460-
.get(&PtxLint::Verbose).is_some_and(|level| *level > LintLevel::Warn)
462+
.get(&PtxLint::Verbose)
463+
.is_some_and(|level| *level > LintLevel::Warn)
461464
{
462465
options.push(c"--verbose");
463466
}
464467
if ptx_lint_levels
465-
.get(&PtxLint::DoublePrecisionUse).is_some_and(|level| *level > LintLevel::Warn)
468+
.get(&PtxLint::DoublePrecisionUse)
469+
.is_some_and(|level| *level > LintLevel::Warn)
466470
{
467471
options.push(c"--warn-on-double-precision-use");
468472
}
469473
if ptx_lint_levels
470-
.get(&PtxLint::LocalMemoryUse).is_some_and(|level| *level > LintLevel::Warn)
474+
.get(&PtxLint::LocalMemoryUse)
475+
.is_some_and(|level| *level > LintLevel::Warn)
471476
{
472477
options.push(c"--warn-on-local-memory-usage");
473478
}
474479
if ptx_lint_levels
475-
.get(&PtxLint::RegisterSpills).is_some_and(|level| *level > LintLevel::Warn) {
480+
.get(&PtxLint::RegisterSpills)
481+
.is_some_and(|level| *level > LintLevel::Warn)
482+
{
476483
options.push(c"--warn-on-spills");
477484
}
478485
if ptx_lint_levels
@@ -498,21 +505,26 @@ fn check_kernel_ptx(
498505
};
499506

500507
if ptx_lint_levels
501-
.get(&PtxLint::Verbose).is_some_and(|level| *level > LintLevel::Allow)
508+
.get(&PtxLint::Verbose)
509+
.is_some_and(|level| *level > LintLevel::Allow)
502510
{
503511
options.push(c"--verbose");
504512
}
505513
if ptx_lint_levels
506-
.get(&PtxLint::DoublePrecisionUse).is_some_and(|level| *level > LintLevel::Allow) {
514+
.get(&PtxLint::DoublePrecisionUse)
515+
.is_some_and(|level| *level > LintLevel::Allow)
516+
{
507517
options.push(c"--warn-on-double-precision-use");
508518
}
509519
if ptx_lint_levels
510-
.get(&PtxLint::LocalMemoryUse).is_some_and(|level| *level > LintLevel::Allow)
520+
.get(&PtxLint::LocalMemoryUse)
521+
.is_some_and(|level| *level > LintLevel::Allow)
511522
{
512523
options.push(c"--warn-on-local-memory-usage");
513524
}
514525
if ptx_lint_levels
515-
.get(&PtxLint::RegisterSpills).is_some_and(|level| *level > LintLevel::Allow)
526+
.get(&PtxLint::RegisterSpills)
527+
.is_some_and(|level| *level > LintLevel::Allow)
516528
{
517529
options.push(c"--warn-on-spills");
518530
}

src/kernel/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use core::str;
21
#[cfg(feature = "host")]
32
use std::{
43
ffi::{CStr, CString},
@@ -309,7 +308,7 @@ impl RawPtxKernel {
309308
// FIXME: cust's Module::get_function takes a str and turns it back into
310309
// a CString immediately
311310
let function = unsafe { &*std::ptr::from_ref(module.as_ref()) }
312-
.get_function(unsafe { str::from_utf8_unchecked(entry_point.to_bytes()) });
311+
.get_function(unsafe { core::str::from_utf8_unchecked(entry_point.to_bytes()) });
313312

314313
let function = match function {
315314
Ok(function) => function,

src/kernel/param.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -807,10 +807,7 @@ impl<'a, T: Sync + RustToCuda + SafeMutableAliasing> CudaKernelParameter
807807
}
808808
}
809809
}
810-
impl<T: Sync + RustToCuda + SafeMutableAliasing> sealed::Sealed
811-
for &mut DeepPerThreadBorrow<T>
812-
{
813-
}
810+
impl<T: Sync + RustToCuda + SafeMutableAliasing> sealed::Sealed for &mut DeepPerThreadBorrow<T> {}
814811

815812
impl<
816813
T: Send

src/kernel/ptx_jit/regex.rs

-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use std::sync::OnceLock;
22

33
use regex::bytes::Regex;
44

5-
#[expect(clippy::module_name_repetitions)]
65
pub fn const_marker_regex() -> &'static Regex {
76
static CONST_MARKER_REGEX: OnceLock<Regex> = OnceLock::new();
87
#[allow(clippy::unwrap_used)]
@@ -12,7 +11,6 @@ pub fn const_marker_regex() -> &'static Regex {
1211
})
1312
}
1413

15-
#[expect(clippy::module_name_repetitions)]
1614
pub fn const_base_register_regex() -> &'static Regex {
1715
static CONST_BASE_REGISTER_REGEX: OnceLock<Regex> = OnceLock::new();
1816
#[allow(clippy::unwrap_used)]
@@ -22,7 +20,6 @@ pub fn const_base_register_regex() -> &'static Regex {
2220
})
2321
}
2422

25-
#[expect(clippy::module_name_repetitions)]
2623
pub fn const_load_instruction_regex() -> &'static Regex {
2724
static CONST_LOAD_INSTRUCTION_REGEX: OnceLock<Regex> = OnceLock::new();
2825
#[allow(clippy::unwrap_used)]
@@ -54,7 +51,6 @@ pub fn const_load_instruction_regex() -> &'static Regex {
5451
})
5552
}
5653

57-
#[expect(clippy::module_name_repetitions)]
5854
pub fn register_regex() -> &'static Regex {
5955
static REGISTER_REGEX: OnceLock<Regex> = OnceLock::new();
6056
#[allow(clippy::unwrap_used)]

src/lend/impls/arc.rs

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ use crate::{
3030
#[doc(hidden)]
3131
#[repr(transparent)]
3232
#[derive(TypeLayout)]
33-
#[expect(clippy::module_name_repetitions)]
3433
pub struct ArcCudaRepresentation<T: PortableBitSemantics + TypeGraphLayout>(
3534
DeviceOwnedPointer<_ArcInner<T>>,
3635
);

src/lend/impls/box.rs

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ use crate::{
2929
#[doc(hidden)]
3030
#[repr(transparent)]
3131
#[derive(TypeLayout)]
32-
#[expect(clippy::module_name_repetitions)]
3332
pub struct BoxCudaRepresentation<T: PortableBitSemantics + TypeGraphLayout>(DeviceOwnedPointer<T>);
3433

3534
unsafe impl<T: PortableBitSemantics + TypeGraphLayout> RustToCuda for Box<T> {

src/lend/impls/boxed_slice.rs

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use crate::{
2626
};
2727

2828
#[doc(hidden)]
29-
#[expect(clippy::module_name_repetitions)]
3029
#[derive(TypeLayout)]
3130
#[repr(C)]
3231
pub struct BoxedSliceCudaRepresentation<T: PortableBitSemantics + TypeGraphLayout> {

src/lend/impls/final.rs

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use crate::{
66
};
77

88
#[doc(hidden)]
9-
#[expect(clippy::module_name_repetitions)]
109
#[derive(const_type_layout::TypeLayout)]
1110
#[repr(transparent)]
1211
pub struct FinalCudaRepresentation<T: CudaAsRust>(DeviceAccessible<T>);

src/lend/impls/option.rs

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use crate::{
1818
};
1919

2020
#[doc(hidden)]
21-
#[expect(clippy::module_name_repetitions)]
2221
#[derive(TypeLayout)]
2322
#[repr(C)]
2423
pub struct OptionCudaRepresentation<T: CudaAsRust> {

src/lend/impls/ref.rs

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ use crate::{
2727
#[doc(hidden)]
2828
#[repr(transparent)]
2929
#[derive(TypeLayout)]
30-
#[expect(clippy::module_name_repetitions)]
3130
pub struct RefCudaRepresentation<'a, T: 'a + PortableBitSemantics + TypeGraphLayout> {
3231
data: DeviceConstPointer<T>,
3332
_marker: PhantomData<&'a T>,

src/lend/impls/ref_mut.rs

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use crate::{
2424
#[doc(hidden)]
2525
#[repr(transparent)]
2626
#[derive(TypeLayout)]
27-
#[expect(clippy::module_name_repetitions)]
2827
pub struct RefMutCudaRepresentation<'a, T: 'a + PortableBitSemantics + TypeGraphLayout> {
2928
data: DeviceMutPointer<T>,
3029
_marker: PhantomData<&'a mut T>,

src/lend/impls/slice_ref.rs

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ use crate::{
2525
};
2626

2727
#[doc(hidden)]
28-
#[expect(clippy::module_name_repetitions)]
2928
#[derive(TypeLayout)]
3029
#[repr(C)]
3130
pub struct SliceRefCudaRepresentation<'a, T: 'a + PortableBitSemantics + TypeGraphLayout> {

src/lend/impls/slice_ref_mut.rs

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use crate::{
2222
};
2323

2424
#[doc(hidden)]
25-
#[expect(clippy::module_name_repetitions)]
2625
#[derive(TypeLayout)]
2726
#[repr(C)]
2827
pub struct SliceRefMutCudaRepresentation<'a, T: 'a + PortableBitSemantics + TypeGraphLayout> {

src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#![feature(negative_impls)]
3030
#![cfg_attr(all(feature = "device", not(doc)), feature(stdarch_nvptx))]
3131
#![cfg_attr(feature = "device", feature(asm_experimental_arch))]
32-
#![cfg_attr(feature = "device", feature(asm_const))]
3332
#![feature(doc_auto_cfg)]
3433
#![feature(doc_cfg)]
3534
#![feature(marker_trait_attr)]
@@ -48,7 +47,6 @@
4847
#![feature(generic_const_exprs)]
4948
#![expect(internal_features)]
5049
#![feature(core_intrinsics)]
51-
// #![feature(const_intrinsic_compare_bytes)]
5250
#![doc(html_root_url = "https://juntyr.github.io/rust-cuda/")]
5351

5452
#[cfg(all(feature = "host", feature = "device", not(doc)))]

src/safety/aliasing.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#[expect(clippy::module_name_repetitions)]
21
/// Types for which mutable references can be safely shared with each CUDA
32
/// thread without breaking Rust's no-mutable-aliasing memory safety
43
/// guarantees.

src/safety/portable.rs

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ macro_rules! portable_bit_semantics_docs {
3636

3737
#[cfg(not(doc))]
3838
portable_bit_semantics_docs! {
39-
#[expect(clippy::module_name_repetitions)]
4039
pub trait PortableBitSemantics: sealed::PortableBitSemantics {}
4140
}
4241
#[cfg(doc)]

src/utils/async.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,7 @@ struct AsyncFuture<'a, 'stream, T: BorrowMut<C::Completed>, C: Completion<T>> {
434434
}
435435

436436
#[cfg(feature = "host")]
437-
impl<T: BorrowMut<C::Completed>, C: Completion<T>> Future
438-
for AsyncFuture<'_, '_, T, C>
439-
{
437+
impl<T: BorrowMut<C::Completed>, C: Completion<T>> Future for AsyncFuture<'_, '_, T, C> {
440438
type Output = CudaResult<T>;
441439

442440
fn poll(
@@ -517,9 +515,7 @@ impl<'a, 'stream, T: BorrowMut<C::Completed>, C: Completion<T>> IntoFuture
517515
}
518516

519517
#[cfg(feature = "host")]
520-
impl<T: BorrowMut<C::Completed>, C: Completion<T>> Drop
521-
for AsyncFuture<'_, '_, T, C>
522-
{
518+
impl<T: BorrowMut<C::Completed>, C: Completion<T>> Drop for AsyncFuture<'_, '_, T, C> {
523519
fn drop(&mut self) {
524520
let Some(mut value) = self.value.take() else {
525521
return;

src/utils/exchange/buffer/device.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use crate::{
99

1010
use super::CudaExchangeItem;
1111

12-
#[expect(clippy::module_name_repetitions)]
1312
pub struct CudaExchangeBufferDevice<
1413
T: StackOnly + PortableBitSemantics + TypeGraphLayout,
1514
const M2D: bool,

src/utils/exchange/buffer/host.rs

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use crate::{
2222

2323
use super::{common::CudaExchangeBufferCudaRepresentation, CudaExchangeItem};
2424

25-
#[expect(clippy::module_name_repetitions)]
2625
pub struct CudaExchangeBufferHost<
2726
T: StackOnly + PortableBitSemantics + TypeGraphLayout,
2827
const M2D: bool,

src/utils/shared/slice.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use core::alloc::Layout;
22

33
use const_type_layout::TypeGraphLayout;
44

5-
#[expect(clippy::module_name_repetitions)]
65
#[repr(transparent)]
76
pub struct ThreadBlockSharedSlice<T: 'static + TypeGraphLayout> {
87
shared: *mut [T],

0 commit comments

Comments
 (0)