Skip to content

Commit e89035b

Browse files
authored
Merge pull request #55 from harrysarson/must_use
mark eq and ne fns as #[must_use]
2 parents 0527afe + 4718ed8 commit e89035b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: rust
22

33
rust:
4-
- 1.20.0
4+
- 1.27.2
55
- nightly
66
- beta
77
- stable
@@ -18,7 +18,7 @@ matrix:
1818
- rust: nightly
1919

2020
before_script:
21-
- if [ "$TRAVIS_RUST_VERSION" == "1.20.0" ]; then rm -f tests/macro_import.rs; fi
21+
- if [ "$TRAVIS_RUST_VERSION" == "1.27.2" ]; then rm -f tests/macro_import.rs; fi
2222
- cargo build --verbose
2323

2424
script:

src/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,14 @@ where
223223

224224
/// Peform the equality comparison
225225
#[inline]
226+
#[must_use]
226227
pub fn eq(self, lhs: &A, rhs: &B) -> bool {
227228
A::abs_diff_eq(lhs, rhs, self.epsilon)
228229
}
229230

230231
/// Peform the inequality comparison
231232
#[inline]
233+
#[must_use]
232234
pub fn ne(self, lhs: &A, rhs: &B) -> bool {
233235
A::abs_diff_ne(lhs, rhs, self.epsilon)
234236
}
@@ -299,12 +301,14 @@ where
299301

300302
/// Peform the equality comparison
301303
#[inline]
304+
#[must_use]
302305
pub fn eq(self, lhs: &A, rhs: &B) -> bool {
303306
A::relative_eq(lhs, rhs, self.epsilon, self.max_relative)
304307
}
305308

306309
/// Peform the inequality comparison
307310
#[inline]
311+
#[must_use]
308312
pub fn ne(self, lhs: &A, rhs: &B) -> bool {
309313
A::relative_ne(lhs, rhs, self.epsilon, self.max_relative)
310314
}
@@ -372,12 +376,14 @@ where
372376

373377
/// Peform the equality comparison
374378
#[inline]
379+
#[must_use]
375380
pub fn eq(self, lhs: &A, rhs: &B) -> bool {
376381
A::ulps_eq(lhs, rhs, self.epsilon, self.max_ulps)
377382
}
378383

379384
/// Peform the inequality comparison
380385
#[inline]
386+
#[must_use]
381387
pub fn ne(self, lhs: &A, rhs: &B) -> bool {
382388
A::ulps_ne(lhs, rhs, self.epsilon, self.max_ulps)
383389
}

0 commit comments

Comments
 (0)