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

Lines changed: 10 additions & 10 deletions
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 22 additions & 10 deletions
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

Lines changed: 1 addition & 2 deletions
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

Lines changed: 1 addition & 4 deletions
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

Lines changed: 0 additions & 4 deletions
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 1 deletion
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> {

0 commit comments

Comments
 (0)