Skip to content

Commit c42d1fc

Browse files
committed
Remove unused P stuff.
1 parent 6859750 commit c42d1fc

File tree

1 file changed

+2
-42
lines changed

1 file changed

+2
-42
lines changed

compiler/rustc_ast/src/ptr.rs

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717
//! heap, for example). Moreover, a switch to, e.g., `P<'a, T>` would be easy
1818
//! and mostly automated.
1919
20-
use std::fmt::{self, Debug, Display};
20+
use std::fmt::{self, Debug};
2121
use std::ops::{Deref, DerefMut};
2222

23-
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
2423
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
2524

2625
/// An owned smart pointer.
@@ -37,28 +36,10 @@ pub fn P<T>(value: T) -> P<T> {
3736
}
3837

3938
impl<T> P<T> {
40-
/// Move out of the pointer.
41-
/// Intended for chaining transformations not covered by `map`.
42-
pub fn and_then<U, F>(self, f: F) -> U
43-
where
44-
F: FnOnce(T) -> U,
45-
{
46-
f(*self.ptr)
47-
}
48-
49-
/// Equivalent to `and_then(|x| x)`.
39+
/// Consume the `P` and return the wrapped value.
5040
pub fn into_inner(self) -> T {
5141
*self.ptr
5242
}
53-
54-
/// Optionally produce a new `P<T>` from `self` without reallocating.
55-
pub fn filter_map<F>(mut self, f: F) -> Option<P<T>>
56-
where
57-
F: FnOnce(T) -> Option<T>,
58-
{
59-
*self.ptr = f(*self.ptr)?;
60-
Some(self)
61-
}
6243
}
6344

6445
impl<T: ?Sized> Deref for P<T> {
@@ -87,18 +68,6 @@ impl<T: ?Sized + Debug> Debug for P<T> {
8768
}
8869
}
8970

90-
impl<T: Display> Display for P<T> {
91-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
92-
Display::fmt(&**self, f)
93-
}
94-
}
95-
96-
impl<T> fmt::Pointer for P<T> {
97-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
98-
fmt::Pointer::fmt(&self.ptr, f)
99-
}
100-
}
101-
10271
impl<D: Decoder, T: Decodable<D>> Decodable<D> for P<T> {
10372
fn decode(d: &mut D) -> P<T> {
10473
P(Decodable::decode(d))
@@ -110,12 +79,3 @@ impl<S: Encoder, T: Encodable<S>> Encodable<S> for P<T> {
11079
(**self).encode(s);
11180
}
11281
}
113-
114-
impl<CTX, T> HashStable<CTX> for P<T>
115-
where
116-
T: ?Sized + HashStable<CTX>,
117-
{
118-
fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) {
119-
(**self).hash_stable(hcx, hasher);
120-
}
121-
}

0 commit comments

Comments
 (0)