Skip to content

Commit 0afef7d

Browse files
committed
self
1 parent 0fa4adf commit 0afef7d

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

src/dim4.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ pub struct Dim4 {
99

1010
/// Default trait for Dim4 returns an Array of dimensions [1, 1, 1, 1]
1111
impl Default for Dim4 {
12-
fn default() -> Dim4 {
13-
Dim4 { dims: [1, 1, 1, 1] }
12+
fn default() -> Self {
13+
Self { dims: [1, 1, 1, 1] }
1414
}
1515
}
1616

@@ -64,8 +64,8 @@ impl Dim4 {
6464
/// use arrayfire::Dim4;
6565
/// let dims = Dim4::new(&[4, 4, 2, 1]);
6666
/// ```
67-
pub fn new(dims: &[u64; 4]) -> Dim4 {
68-
Dim4 { dims: dims.clone() }
67+
pub fn new(dims: &[u64; 4]) -> Self {
68+
Self { dims: dims.clone() }
6969
}
7070

7171
/// Get the number of elements represented by Dim4 object

src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub struct Callback {
2424
impl Callback {
2525
/// Associated function to create a new Callback object
2626
pub fn new(callback: ErrorCallback) -> Self {
27-
Callback { cb: callback }
27+
Self { cb: callback }
2828
}
2929

3030
/// call invokes the error callback with `error_code`.

src/graphics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl Window {
225225
cstr.as_ptr(),
226226
);
227227
HANDLE_ERROR(AfError::from(err_val));
228-
Window::from(temp)
228+
Self::from(temp)
229229
}
230230
Err(_) => {
231231
panic!("String creation failed while prepping params for window creation.")

src/util.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,42 +71,42 @@ pub fn free_host<T>(ptr: *mut T) {
7171
}
7272

7373
impl From<i32> for AfError {
74-
fn from(t: i32) -> AfError {
74+
fn from(t: i32) -> Self {
7575
assert!(AfError::SUCCESS as i32 <= t && t <= AfError::ERR_UNKNOWN as i32);
7676
unsafe { mem::transmute(t) }
7777
}
7878
}
7979

8080
impl From<u32> for DType {
81-
fn from(t: u32) -> DType {
81+
fn from(t: u32) -> Self {
8282
assert!(DType::F32 as u32 <= t && t <= DType::U64 as u32);
8383
unsafe { mem::transmute(t) }
8484
}
8585
}
8686

8787
impl From<u32> for InterpType {
88-
fn from(t: u32) -> InterpType {
88+
fn from(t: u32) -> Self {
8989
assert!(InterpType::NEAREST as u32 <= t && t <= InterpType::BICUBIC_SPLINE as u32);
9090
unsafe { mem::transmute(t) }
9191
}
9292
}
9393

9494
impl From<u32> for ConvMode {
95-
fn from(t: u32) -> ConvMode {
95+
fn from(t: u32) -> Self {
9696
assert!(ConvMode::DEFAULT as u32 <= t && t <= ConvMode::EXPAND as u32);
9797
unsafe { mem::transmute(t) }
9898
}
9999
}
100100

101101
impl From<u32> for ConvDomain {
102-
fn from(t: u32) -> ConvDomain {
102+
fn from(t: u32) -> Self {
103103
assert!(ConvDomain::AUTO as u32 <= t && t <= ConvDomain::FREQUENCY as u32);
104104
unsafe { mem::transmute(t) }
105105
}
106106
}
107107

108108
impl From<u32> for MatchType {
109-
fn from(t: u32) -> MatchType {
109+
fn from(t: u32) -> Self {
110110
assert!(MatchType::SAD as u32 <= t && t <= MatchType::SHD as u32);
111111
unsafe { mem::transmute(t) }
112112
}
@@ -129,7 +129,7 @@ pub fn to_u32(t: MatProp) -> u32 {
129129
}
130130

131131
impl From<u32> for ColorMap {
132-
fn from(t: u32) -> ColorMap {
132+
fn from(t: u32) -> Self {
133133
assert!(ColorMap::DEFAULT as u32 <= t && t <= ColorMap::BLUE as u32);
134134
unsafe { mem::transmute(t) }
135135
}

0 commit comments

Comments
 (0)