|
7 | 7 | // option. This file may not be copied, modified, or distributed |
8 | 8 | // except according to those terms. |
9 | 9 |
|
10 | | -#![allow(non_upper_case_globals)] |
11 | | - |
12 | 10 | use crate::dynamic_set::{Entry, DYNAMIC_SET}; |
13 | 11 | use crate::static_sets::StaticAtomSet; |
14 | 12 | use debug_unreachable::debug_unreachable; |
15 | 13 | use phf_shared; |
16 | | -use serde::{Deserialize, Deserializer, Serialize, Serializer}; |
17 | 14 | use std::borrow::Cow; |
18 | 15 | use std::cmp::Ordering::{self, Equal}; |
19 | 16 | use std::fmt; |
@@ -85,18 +82,6 @@ pub struct Atom<Static> { |
85 | 82 | phantom: PhantomData<Static>, |
86 | 83 | } |
87 | 84 |
|
88 | | -impl<Static: StaticAtomSet> ::precomputed_hash::PrecomputedHash for Atom<Static> { |
89 | | - fn precomputed_hash(&self) -> u32 { |
90 | | - self.get_hash() |
91 | | - } |
92 | | -} |
93 | | - |
94 | | -impl<'a, Static: StaticAtomSet> From<&'a Atom<Static>> for Atom<Static> { |
95 | | - fn from(atom: &'a Self) -> Self { |
96 | | - atom.clone() |
97 | | - } |
98 | | -} |
99 | | - |
100 | 85 | // FIXME: bound removed from the struct definition before of this error for pack_static: |
101 | 86 | // "error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable" |
102 | 87 | // https://github.com/rust-lang/rust/issues/57563 |
@@ -183,24 +168,6 @@ impl<Static: StaticAtomSet> Hash for Atom<Static> { |
183 | 168 | } |
184 | 169 | } |
185 | 170 |
|
186 | | -impl<Static: StaticAtomSet> PartialEq<str> for Atom<Static> { |
187 | | - fn eq(&self, other: &str) -> bool { |
188 | | - &self[..] == other |
189 | | - } |
190 | | -} |
191 | | - |
192 | | -impl<Static: StaticAtomSet> PartialEq<Atom<Static>> for str { |
193 | | - fn eq(&self, other: &Atom<Static>) -> bool { |
194 | | - self == &other[..] |
195 | | - } |
196 | | -} |
197 | | - |
198 | | -impl<Static: StaticAtomSet> PartialEq<String> for Atom<Static> { |
199 | | - fn eq(&self, other: &String) -> bool { |
200 | | - &self[..] == &other[..] |
201 | | - } |
202 | | -} |
203 | | - |
204 | 171 | impl<'a, Static: StaticAtomSet> From<Cow<'a, str>> for Atom<Static> { |
205 | 172 | fn from(string_to_add: Cow<'a, str>) -> Self { |
206 | 173 | let static_set = Static::get(); |
@@ -237,20 +204,6 @@ impl<'a, Static: StaticAtomSet> From<Cow<'a, str>> for Atom<Static> { |
237 | 204 | } |
238 | 205 | } |
239 | 206 |
|
240 | | -impl<'a, Static: StaticAtomSet> From<&'a str> for Atom<Static> { |
241 | | - #[inline] |
242 | | - fn from(string_to_add: &str) -> Self { |
243 | | - Atom::from(Cow::Borrowed(string_to_add)) |
244 | | - } |
245 | | -} |
246 | | - |
247 | | -impl<Static: StaticAtomSet> From<String> for Atom<Static> { |
248 | | - #[inline] |
249 | | - fn from(string_to_add: String) -> Self { |
250 | | - Atom::from(Cow::Owned(string_to_add)) |
251 | | - } |
252 | | -} |
253 | | - |
254 | 207 | impl<Static: StaticAtomSet> Clone for Atom<Static> { |
255 | 208 | #[inline(always)] |
256 | 209 | fn clone(&self) -> Self { |
@@ -305,13 +258,6 @@ impl<Static: StaticAtomSet> ops::Deref for Atom<Static> { |
305 | 258 | } |
306 | 259 | } |
307 | 260 |
|
308 | | -impl<Static: StaticAtomSet> fmt::Display for Atom<Static> { |
309 | | - #[inline] |
310 | | - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
311 | | - <str as fmt::Display>::fmt(self, f) |
312 | | - } |
313 | | -} |
314 | | - |
315 | 261 | impl<Static: StaticAtomSet> fmt::Debug for Atom<Static> { |
316 | 262 | #[inline] |
317 | 263 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
@@ -348,32 +294,6 @@ impl<Static: StaticAtomSet> Ord for Atom<Static> { |
348 | 294 | } |
349 | 295 | } |
350 | 296 |
|
351 | | -impl<Static: StaticAtomSet> AsRef<str> for Atom<Static> { |
352 | | - fn as_ref(&self) -> &str { |
353 | | - &self |
354 | | - } |
355 | | -} |
356 | | - |
357 | | -impl<Static: StaticAtomSet> Serialize for Atom<Static> { |
358 | | - fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> |
359 | | - where |
360 | | - S: Serializer, |
361 | | - { |
362 | | - let string: &str = self.as_ref(); |
363 | | - string.serialize(serializer) |
364 | | - } |
365 | | -} |
366 | | - |
367 | | -impl<'a, Static: StaticAtomSet> Deserialize<'a> for Atom<Static> { |
368 | | - fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
369 | | - where |
370 | | - D: Deserializer<'a>, |
371 | | - { |
372 | | - let string: String = Deserialize::deserialize(deserializer)?; |
373 | | - Ok(Atom::from(string)) |
374 | | - } |
375 | | -} |
376 | | - |
377 | 297 | // AsciiExt requires mutating methods, so we just implement the non-mutating ones. |
378 | 298 | // We don't need to implement is_ascii because there's no performance improvement |
379 | 299 | // over the one from &str. |
|
0 commit comments