Skip to content

Commit 89ef637

Browse files
committed
remove bad example from PartialEq docs
Fixes #24173
1 parent 5910dc0 commit 89ef637

File tree

1 file changed

+0
-21
lines changed

1 file changed

+0
-21
lines changed

src/libcore/cmp.rs

-21
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,6 @@
1414
//! implement comparison operators. Rust programs may implement `PartialOrd` to overload the `<`,
1515
//! `<=`, `>`, and `>=` operators, and may implement `PartialEq` to overload the `==` and `!=`
1616
//! operators.
17-
//!
18-
//! For example, to define a type with a customized definition for the PartialEq operators, you
19-
//! could do the following:
20-
//!
21-
//! ```
22-
//! # #![feature(core)]
23-
//! struct FuzzyNum {
24-
//! num: i32,
25-
//! }
26-
//!
27-
//! impl PartialEq for FuzzyNum {
28-
//! // Our custom eq allows numbers which are near each other to be equal! :D
29-
//! fn eq(&self, other: &FuzzyNum) -> bool {
30-
//! (self.num - other.num).abs() < 5
31-
//! }
32-
//! }
33-
//!
34-
//! // Now these binary operators will work when applied!
35-
//! assert!(FuzzyNum { num: 37 } == FuzzyNum { num: 34 });
36-
//! assert!(FuzzyNum { num: 25 } != FuzzyNum { num: 57 });
37-
//! ```
3817
3918
#![stable(feature = "rust1", since = "1.0.0")]
4019

0 commit comments

Comments
 (0)