Skip to content

Commit

Permalink
libextra: Remove @str from all the libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
pcwalton authored and huonw committed Feb 1, 2014
1 parent 4dbcf80 commit 449a7a8
Show file tree
Hide file tree
Showing 13 changed files with 12 additions and 169 deletions.
12 changes: 0 additions & 12 deletions src/libextra/serialize.rs
Expand Up @@ -310,18 +310,6 @@ impl<D:Decoder> Decodable<D> for ~str {
}
}

impl<S:Encoder> Encodable<S> for @str {
fn encode(&self, s: &mut S) {
s.emit_str(*self)
}
}

impl<D:Decoder> Decodable<D> for @str {
fn decode(d: &mut D) -> @str {
d.read_str().to_managed()
}
}

impl<S:Encoder> Encodable<S> for f32 {
fn encode(&self, s: &mut S) {
s.emit_f32(*self)
Expand Down
1 change: 0 additions & 1 deletion src/libstd/at_vec.rs
Expand Up @@ -338,7 +338,6 @@ mod test {
assert_eq!(to_managed::<int>([]), @[]);
assert_eq!(to_managed([true]), @[true]);
assert_eq!(to_managed([1, 2, 3, 4, 5]), @[1, 2, 3, 4, 5]);
assert_eq!(to_managed([@"abc", @"123"]), @[@"abc", @"123"]);
assert_eq!(to_managed([@[42]]), @[@[42]]);
}

Expand Down
1 change: 0 additions & 1 deletion src/libstd/fmt/mod.rs
Expand Up @@ -1167,7 +1167,6 @@ delegate!( u8 to Unsigned)
delegate!( u16 to Unsigned)
delegate!( u32 to Unsigned)
delegate!( u64 to Unsigned)
delegate!(@str to String)
delegate!(~str to String)
delegate!(&'a str to String)
delegate!(bool to Bool)
Expand Down
13 changes: 0 additions & 13 deletions src/libstd/path/mod.rs
Expand Up @@ -604,19 +604,6 @@ impl BytesContainer for ~str {
fn is_str(_: Option<~str>) -> bool { true }
}

impl BytesContainer for @str {
#[inline]
fn container_as_bytes<'a>(&'a self) -> &'a [u8] {
self.as_bytes()
}
#[inline]
fn container_as_str<'a>(&'a self) -> Option<&'a str> {
Some(self.as_slice())
}
#[inline]
fn is_str(_: Option<@str>) -> bool { true }
}

impl<'a> BytesContainer for &'a [u8] {
#[inline]
fn container_as_bytes<'a>(&'a self) -> &'a [u8] {
Expand Down
2 changes: 0 additions & 2 deletions src/libstd/path/posix.rs
Expand Up @@ -830,7 +830,6 @@ mod tests {
t!(s: "a/b/c", ["d", "/e"], "/e");
t!(s: "a/b/c", ["d", "/e", "f"], "/e/f");
t!(s: "a/b/c", [~"d", ~"e"], "a/b/c/d/e");
t!(s: "a/b/c", [@"d", @"e"], "a/b/c/d/e");
t!(v: b!("a/b/c"), [b!("d"), b!("e")], b!("a/b/c/d/e"));
t!(v: b!("a/b/c"), [b!("d"), b!("/e"), b!("f")], b!("/e/f"));
t!(v: b!("a/b/c"), [b!("d").to_owned(), b!("e").to_owned()], b!("a/b/c/d/e"));
Expand Down Expand Up @@ -940,7 +939,6 @@ mod tests {
t!(s: "a/b/c", ["..", "d"], "a/b/d");
t!(s: "a/b/c", ["d", "/e", "f"], "/e/f");
t!(s: "a/b/c", [~"d", ~"e"], "a/b/c/d/e");
t!(s: "a/b/c", [@"d", @"e"], "a/b/c/d/e");
t!(v: b!("a/b/c"), [b!("d"), b!("e")], b!("a/b/c/d/e"));
t!(v: b!("a/b/c"), [b!("d").to_owned(), b!("e").to_owned()], b!("a/b/c/d/e"));
t!(v: b!("a/b/c"), [to_man(b!("d").to_owned()), to_man(b!("e").to_owned())],
Expand Down
2 changes: 0 additions & 2 deletions src/libstd/path/windows.rs
Expand Up @@ -1610,7 +1610,6 @@ mod tests {
t!(s: "a\\b\\c", ["d", "\\e"], "\\e");
t!(s: "a\\b\\c", ["d", "\\e", "f"], "\\e\\f");
t!(s: "a\\b\\c", [~"d", ~"e"], "a\\b\\c\\d\\e");
t!(s: "a\\b\\c", [@"d", @"e"], "a\\b\\c\\d\\e");
t!(v: b!("a\\b\\c"), [b!("d"), b!("e")], b!("a\\b\\c\\d\\e"));
t!(v: b!("a\\b\\c"), [b!("d"), b!("\\e"), b!("f")], b!("\\e\\f"));
t!(v: b!("a\\b\\c"), [b!("d").to_owned(), b!("e").to_owned()], b!("a\\b\\c\\d\\e"));
Expand Down Expand Up @@ -1755,7 +1754,6 @@ mod tests {
t!(s: "a\\b\\c", ["..", "d"], "a\\b\\d");
t!(s: "a\\b\\c", ["d", "\\e", "f"], "\\e\\f");
t!(s: "a\\b\\c", [~"d", ~"e"], "a\\b\\c\\d\\e");
t!(s: "a\\b\\c", [@"d", @"e"], "a\\b\\c\\d\\e");
t!(v: b!("a\\b\\c"), [b!("d"), b!("e")], b!("a\\b\\c\\d\\e"));
t!(v: b!("a\\b\\c"), [b!("d").to_owned(), b!("e").to_owned()], b!("a\\b\\c\\d\\e"));
t!(v: b!("a\\b\\c"), [to_man(b!("d").to_owned()), to_man(b!("e").to_owned())],
Expand Down
3 changes: 0 additions & 3 deletions src/libstd/reflect.rs
Expand Up @@ -183,9 +183,6 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
}

fn visit_estr_box(&mut self) -> bool {
self.align_to::<@str>();
if ! self.inner.visit_estr_box() { return false; }
self.bump_past::<@str>();
true
}

Expand Down
6 changes: 1 addition & 5 deletions src/libstd/repr.rs
Expand Up @@ -272,10 +272,7 @@ impl<'a> TyVisitor for ReprVisitor<'a> {
}

fn visit_estr_box(&mut self) -> bool {
self.get::<@str>(|this, s| {
this.writer.write(['@' as u8]);
this.write_escaped_slice(*s);
})
true
}

fn visit_estr_uniq(&mut self) -> bool {
Expand Down Expand Up @@ -628,7 +625,6 @@ fn test_repr() {
exact_test(&false, "false");
exact_test(&1.234, "1.234f64");
exact_test(&(&"hello"), "\"hello\"");
exact_test(&(@"hello"), "@\"hello\"");
exact_test(&(~"he\u10f3llo"), "~\"he\\u10f3llo\"");

exact_test(&(@10), "@10");
Expand Down
2 changes: 0 additions & 2 deletions src/libstd/send_str.rs
Expand Up @@ -185,15 +185,13 @@ mod tests {
assert_eq!(s.len(), 5);
assert_eq!(s.as_slice(), "abcde");
assert_eq!(s.to_str(), ~"abcde");
assert!(s.equiv(&@"abcde"));
assert!(s.lt(&SendStrOwned(~"bcdef")));
assert_eq!(SendStrStatic(""), Default::default());

let o = SendStrOwned(~"abcde");
assert_eq!(o.len(), 5);
assert_eq!(o.as_slice(), "abcde");
assert_eq!(o.to_str(), ~"abcde");
assert!(o.equiv(&@"abcde"));
assert!(o.lt(&SendStrStatic("bcdef")));
assert_eq!(SendStrOwned(~""), Default::default());

Expand Down

0 comments on commit 449a7a8

Please sign in to comment.