Skip to content

Commit 1e02c3d

Browse files
adamnemecek9prady9
authored andcommitted
Use self keyword instead of identifiers where appropriate (#194)
1 parent bd08591 commit 1e02c3d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/random/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ pub struct RandomEngine {
112112

113113
/// Used for creating RandomEngine object from native resource id
114114
impl From<i64> for RandomEngine {
115-
fn from(t: i64) -> RandomEngine {
116-
RandomEngine { handle: t }
115+
fn from(t: i64) -> Self {
116+
Self { handle: t }
117117
}
118118
}
119119

@@ -128,7 +128,7 @@ impl RandomEngine {
128128
/// # Return Values
129129
///
130130
/// A object of type RandomEngine
131-
pub fn new(rengine: RandomEngineType, seed: Option<u64>) -> RandomEngine {
131+
pub fn new(rengine: RandomEngineType, seed: Option<u64>) -> Self {
132132
let mut temp: i64 = 0;
133133
unsafe {
134134
let err_val = af_create_random_engine(
@@ -192,7 +192,7 @@ impl RandomEngine {
192192

193193
/// Increment reference count of RandomEngine's native resource
194194
impl Clone for RandomEngine {
195-
fn clone(&self) -> RandomEngine {
195+
fn clone(&self) -> Self {
196196
unsafe {
197197
let mut temp: i64 = 0;
198198
let err_val =

src/util.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -384,21 +384,21 @@ impl HasAfEnum for u64 {
384384
}
385385

386386
impl From<u32> for SparseFormat {
387-
fn from(t: u32) -> SparseFormat {
387+
fn from(t: u32) -> Self {
388388
assert!(SparseFormat::DENSE as u32 <= t && t <= SparseFormat::COO as u32);
389389
unsafe { mem::transmute(t) }
390390
}
391391
}
392392

393393
impl From<u32> for BinaryOp {
394-
fn from(t: u32) -> BinaryOp {
394+
fn from(t: u32) -> Self {
395395
assert!(BinaryOp::ADD as u32 <= t && t <= BinaryOp::MAX as u32);
396396
unsafe { mem::transmute(t) }
397397
}
398398
}
399399

400400
impl From<u32> for RandomEngineType {
401-
fn from(t: u32) -> RandomEngineType {
401+
fn from(t: u32) -> Self {
402402
assert!(
403403
RandomEngineType::PHILOX_4X32_10 as u32 <= t
404404
&& t <= RandomEngineType::MERSENNE_GP11213 as u32
@@ -598,13 +598,13 @@ implicit!(bool, u8 => u8);
598598

599599
impl Zero for Complex64 {
600600
fn zero() -> Self {
601-
Complex64 { re: 0.0, im: 0.0 }
601+
Self { re: 0.0, im: 0.0 }
602602
}
603603
}
604604

605605
impl Zero for Complex32 {
606606
fn zero() -> Self {
607-
Complex32 { re: 0.0, im: 0.0 }
607+
Self { re: 0.0, im: 0.0 }
608608
}
609609
}
610610

0 commit comments

Comments
 (0)