Skip to content

Commit c8c06ae

Browse files
authored
Merge pull request #127 from cuviper/lints
Fix a few miscellaneous lints
2 parents a52a8e1 + 67398e3 commit c8c06ae

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/crand.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ fn test_rng() -> impl RngCore {
7070
}
7171

7272
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand::Error> {
73-
Ok(self.fill_bytes(dest))
73+
self.fill_bytes(dest);
74+
Ok(())
7475
}
7576
}
7677

@@ -94,7 +95,7 @@ fn generic_standard_f64() {
9495
let mut rng = test_rng();
9596
let dist = ComplexDistribution::new(Standard, Standard);
9697
for _ in 0..100 {
97-
let c: Complex<f64> = rng.sample(&dist);
98+
let c: Complex<f64> = rng.sample(dist);
9899
assert!(c.re >= 0.0 && c.re < 1.0);
99100
assert!(c.im >= 0.0 && c.im < 1.0);
100101
}
@@ -110,7 +111,7 @@ fn generic_uniform_f64() {
110111
let dist = ComplexDistribution::new(re, im);
111112
for _ in 0..100 {
112113
// no type annotation required, since `Uniform` only produces one type.
113-
let c = rng.sample(&dist);
114+
let c = rng.sample(dist);
114115
assert!(c.re >= -100.0 && c.re < 0.0);
115116
assert!(c.im >= 0.0 && c.im < 100.0);
116117
}
@@ -125,7 +126,7 @@ fn generic_mixed_f64() {
125126
let dist = ComplexDistribution::new(re, Standard);
126127
for _ in 0..100 {
127128
// no type annotation required, since `Uniform` only produces one type.
128-
let c = rng.sample(&dist);
129+
let c = rng.sample(dist);
129130
assert!(c.re >= -100.0 && c.re < 0.0);
130131
assert!(c.im >= 0.0 && c.im < 1.0);
131132
}
@@ -141,7 +142,7 @@ fn generic_uniform_i32() {
141142
let dist = ComplexDistribution::new(re, im);
142143
for _ in 0..100 {
143144
// no type annotation required, since `Uniform` only produces one type.
144-
let c = rng.sample(&dist);
145+
let c = rng.sample(dist);
145146
assert!(c.re >= -100 && c.re < 0);
146147
assert!(c.im >= 0 && c.im < 100);
147148
}

src/lib.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ impl<T: Clone + Num + Neg<Output = T>> Inv for Complex<T> {
10061006

10071007
#[inline]
10081008
fn inv(self) -> Self::Output {
1009-
(&self).inv()
1009+
Complex::inv(&self)
10101010
}
10111011
}
10121012

@@ -1015,7 +1015,7 @@ impl<'a, T: Clone + Num + Neg<Output = T>> Inv for &'a Complex<T> {
10151015

10161016
#[inline]
10171017
fn inv(self) -> Self::Output {
1018-
self.inv()
1018+
Complex::inv(self)
10191019
}
10201020
}
10211021

@@ -1390,7 +1390,6 @@ where
13901390
}
13911391
}
13921392

1393-
#[allow(deprecated)] // `trim_left_matches` and `trim_right_matches` since 1.33
13941393
fn from_str_generic<T, E, F>(s: &str, from: F) -> Result<Complex<T>, ParseComplexError<E>>
13951394
where
13961395
F: Fn(&str) -> Result<T, E>,
@@ -1412,8 +1411,8 @@ where
14121411
// ignore '+'/'-' if part of an exponent
14131412
if (c == b'+' || c == b'-') && !(p == b'e' || p == b'E') {
14141413
// trim whitespace around the separator
1415-
a = &s[..=i].trim_right_matches(char::is_whitespace);
1416-
b = &s[i + 2..].trim_left_matches(char::is_whitespace);
1414+
a = s[..=i].trim_end_matches(char::is_whitespace);
1415+
b = s[i + 2..].trim_start_matches(char::is_whitespace);
14171416
neg_b = c == b'-';
14181417

14191418
if b.is_empty() || (neg_b && b.starts_with('-')) {

0 commit comments

Comments
 (0)