Skip to content

Commit 9cbc975

Browse files
committed
Improve code style and clarity of comments
1 parent 0968a71 commit 9cbc975

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/numeric/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ where
4747
// In the empty case, we can just reuse the existing pointer since
4848
// it won't be dereferenced anyway. It is not safe to offset by one
4949
// since the allocation may be empty.
50-
self.ptr.cast()
50+
ptr_re
5151
} else {
52-
// Safe because `self` is nonempty, so we can safely offset into
53-
// the first element.
54-
unsafe { self.ptr.cast().add(1) }
52+
// In the nonempty case, we can safely offset into the first
53+
// (complex) element.
54+
unsafe { ptr_re.add(1) }
5555
};
5656

5757
// `Complex` is `repr(C)` with only fields `re: T` and `im: T`. So, the
@@ -125,11 +125,11 @@ where
125125
// In the empty case, we can just reuse the existing pointer since
126126
// it won't be dereferenced anyway. It is not safe to offset by one
127127
// since the allocation may be empty.
128-
self.ptr.cast()
128+
ptr_re
129129
} else {
130-
// Safe because `self` is nonempty, so we can safely offset into
131-
// the first element.
132-
unsafe { self.ptr.cast().add(1) }
130+
// In the nonempty case, we can safely offset into the first
131+
// (complex) element.
132+
unsafe { ptr_re.add(1) }
133133
};
134134

135135
// `Complex` is `repr(C)` with only fields `re: T` and `im: T`. So, the

0 commit comments

Comments
 (0)