File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
11
11
` Encoding::equivalent_to_start_of_str ` methods for more precise comparison
12
12
semantics.
13
13
14
+ ### Changed
15
+ * Discourage comparing ` str ` with ` Encoding ` using ` PartialEq ` . This trait
16
+ impl might get removed in a future version.
17
+
14
18
15
19
## 2.0.0-beta.0 - 2021-11-22
16
20
Original file line number Diff line number Diff line change @@ -195,16 +195,38 @@ impl fmt::Display for Encoding<'_> {
195
195
}
196
196
}
197
197
198
+ // TODO: Deprecate and remove these PartialEq impls
199
+
200
+ /// Partial equality between an [`Encoding`] and a [`str`].
201
+ ///
202
+ /// Using this is heavily discouraged, since it is not transitive; use
203
+ /// [`Encoding::equivalent_to_str`] instead for more correct semantics.
198
204
impl PartialEq < str > for Encoding < ' _ > {
205
+ /// Using this is discouraged.
199
206
fn eq ( & self , other : & str ) -> bool {
200
207
self . equivalent_to_str ( other)
201
208
}
209
+
210
+ /// Using this is discouraged.
211
+ fn ne ( & self , other : & str ) -> bool {
212
+ !self . eq ( other)
213
+ }
202
214
}
203
215
216
+ /// Partial equality between an [`Encoding`] and a [`str`].
217
+ ///
218
+ /// Using this is heavily discouraged, since it is not transitive; use
219
+ /// [`Encoding::equivalent_to_str`] instead for more correct semantics.
204
220
impl PartialEq < Encoding < ' _ > > for str {
221
+ /// Using this is discouraged.
205
222
fn eq ( & self , other : & Encoding < ' _ > ) -> bool {
206
223
other. equivalent_to_str ( self )
207
224
}
225
+
226
+ /// Using this is discouraged.
227
+ fn ne ( & self , other : & Encoding < ' _ > ) -> bool {
228
+ !self . eq ( other)
229
+ }
208
230
}
209
231
210
232
#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments