Skip to content

Commit 266a976

Browse files
committed
use self
1 parent 5d2ae2d commit 266a976

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/array.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ where
173173
/// print(&indices);
174174
/// ```
175175
#[allow(unused_mut)]
176-
pub fn new(slice: &[T], dims: Dim4) -> Array<T> {
176+
pub fn new(slice: &[T], dims: Dim4) -> Self {
177177
let aftype = T::get_af_dtype();
178178
let mut temp: i64 = 0;
179179
unsafe {
@@ -193,7 +193,7 @@ where
193193
///
194194
/// The data pointed by the slice passed to this function can possibily be offseted using an additional `offset` parameter.
195195
#[allow(unused_mut)]
196-
pub fn new_strided(slice: &[T], offset: i64, dims: Dim4, strides: Dim4) -> Array<T> {
196+
pub fn new_strided(slice: &[T], offset: i64, dims: Dim4, strides: Dim4) -> Self {
197197
let aftype = T::get_af_dtype();
198198
let mut temp: i64 = 0;
199199
unsafe {
@@ -221,7 +221,7 @@ where
221221
/// let garbageVals = Array::<f32>::new_empty(Dim4::new(&[3, 1, 1, 1]));
222222
/// ```
223223
#[allow(unused_mut)]
224-
pub fn new_empty(dims: Dim4) -> Array<T> {
224+
pub fn new_empty(dims: Dim4) -> Self {
225225
let aftype = T::get_af_dtype();
226226
unsafe {
227227
let mut temp: i64 = 0;
@@ -375,7 +375,7 @@ where
375375
/// Makes an copy of the Array
376376
///
377377
/// This does a deep copy of the data into a new Array
378-
pub fn copy(&self) -> Array<T> {
378+
pub fn copy(&self) -> Self {
379379
unsafe {
380380
let mut temp: i64 = 0;
381381
let err_val = af_copy_array(&mut temp as MutAfArray, self.handle as AfArray);
@@ -522,7 +522,7 @@ impl<T> Clone for Array<T>
522522
where
523523
T: HasAfEnum,
524524
{
525-
fn clone(&self) -> Array<T> {
525+
fn clone(&self) -> Self{
526526
unsafe {
527527
let mut temp: i64 = 0;
528528
let ret_val = af_retain_array(&mut temp as MutAfArray, self.handle as AfArray);

src/graphics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ pub struct Window {
174174

175175
/// Used to create Window object from native(ArrayFire) resource handle
176176
impl From<u64> for Window {
177-
fn from(t: u64) -> Window {
178-
Window {
177+
fn from(t: u64) -> Self {
178+
Self {
179179
handle: t,
180180
row: -1,
181181
col: -1,
@@ -212,7 +212,7 @@ impl Window {
212212
///
213213
/// Window Object
214214
#[allow(unused_mut)]
215-
pub fn new(width: i32, height: i32, title: String) -> Window {
215+
pub fn new(width: i32, height: i32, title: String) -> Self {
216216
unsafe {
217217
let mut temp: u64 = 0;
218218
let cstr_ret = CString::new(title);

src/seq.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub struct Seq<T> {
1616
/// Default `Seq` spans all the elements along a dimension
1717
impl<T: One + Zero> Default for Seq<T> {
1818
fn default() -> Self {
19-
Seq {
19+
Self {
2020
begin: One::one(),
2121
end: One::one(),
2222
step: Zero::zero(),
@@ -38,7 +38,7 @@ impl<T: fmt::Display> fmt::Display for Seq<T> {
3838
impl<T: Copy> Seq<T> {
3939
/// Create a `Seq` that goes from `begin` to `end` at a step size of `step`
4040
pub fn new(begin: T, end: T, step: T) -> Self {
41-
Seq {
41+
Self {
4242
begin: begin,
4343
end: end,
4444
step: step,

0 commit comments

Comments
 (0)