Skip to content

Commit 18ca312

Browse files
committed
Remove @ from json::Error
1 parent 631cbd2 commit 18ca312

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

src/libextra/json.rs

+41-41
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub struct Error {
5454
/// The column number at which the error occurred
5555
priv col: uint,
5656
/// A message describing the type of the error
57-
priv msg: @~str,
57+
priv msg: ~str,
5858
}
5959

6060
fn escape_str(s: &str) -> ~str {
@@ -525,7 +525,7 @@ impl<T : Iterator<char>> Parser<T> {
525525
}
526526

527527
fn error<T>(&self, msg: ~str) -> Result<T, Error> {
528-
Err(Error { line: self.line, col: self.col, msg: @msg })
528+
Err(Error { line: self.line, col: self.col, msg: msg })
529529
}
530530

531531
fn parse_value(&mut self) -> Result<Json, Error> {
@@ -1327,7 +1327,7 @@ impl to_str::ToStr for Json {
13271327

13281328
impl to_str::ToStr for Error {
13291329
fn to_str(&self) -> ~str {
1330-
format!("{}:{}: {}", self.line, self.col, *self.msg)
1330+
format!("{}:{}: {}", self.line, self.col, self.msg)
13311331
}
13321332
}
13331333

@@ -1593,35 +1593,35 @@ mod tests {
15931593
#[test]
15941594
fn test_trailing_characters() {
15951595
assert_eq!(from_str("nulla"),
1596-
Err(Error {line: 1u, col: 5u, msg: @~"trailing characters"}));
1596+
Err(Error {line: 1u, col: 5u, msg: ~"trailing characters"}));
15971597
assert_eq!(from_str("truea"),
1598-
Err(Error {line: 1u, col: 5u, msg: @~"trailing characters"}));
1598+
Err(Error {line: 1u, col: 5u, msg: ~"trailing characters"}));
15991599
assert_eq!(from_str("falsea"),
1600-
Err(Error {line: 1u, col: 6u, msg: @~"trailing characters"}));
1600+
Err(Error {line: 1u, col: 6u, msg: ~"trailing characters"}));
16011601
assert_eq!(from_str("1a"),
1602-
Err(Error {line: 1u, col: 2u, msg: @~"trailing characters"}));
1602+
Err(Error {line: 1u, col: 2u, msg: ~"trailing characters"}));
16031603
assert_eq!(from_str("[]a"),
1604-
Err(Error {line: 1u, col: 3u, msg: @~"trailing characters"}));
1604+
Err(Error {line: 1u, col: 3u, msg: ~"trailing characters"}));
16051605
assert_eq!(from_str("{}a"),
1606-
Err(Error {line: 1u, col: 3u, msg: @~"trailing characters"}));
1606+
Err(Error {line: 1u, col: 3u, msg: ~"trailing characters"}));
16071607
}
16081608
16091609
#[test]
16101610
fn test_read_identifiers() {
16111611
assert_eq!(from_str("n"),
1612-
Err(Error {line: 1u, col: 2u, msg: @~"invalid syntax"}));
1612+
Err(Error {line: 1u, col: 2u, msg: ~"invalid syntax"}));
16131613
assert_eq!(from_str("nul"),
1614-
Err(Error {line: 1u, col: 4u, msg: @~"invalid syntax"}));
1614+
Err(Error {line: 1u, col: 4u, msg: ~"invalid syntax"}));
16151615
16161616
assert_eq!(from_str("t"),
1617-
Err(Error {line: 1u, col: 2u, msg: @~"invalid syntax"}));
1617+
Err(Error {line: 1u, col: 2u, msg: ~"invalid syntax"}));
16181618
assert_eq!(from_str("truz"),
1619-
Err(Error {line: 1u, col: 4u, msg: @~"invalid syntax"}));
1619+
Err(Error {line: 1u, col: 4u, msg: ~"invalid syntax"}));
16201620
16211621
assert_eq!(from_str("f"),
1622-
Err(Error {line: 1u, col: 2u, msg: @~"invalid syntax"}));
1622+
Err(Error {line: 1u, col: 2u, msg: ~"invalid syntax"}));
16231623
assert_eq!(from_str("faz"),
1624-
Err(Error {line: 1u, col: 3u, msg: @~"invalid syntax"}));
1624+
Err(Error {line: 1u, col: 3u, msg: ~"invalid syntax"}));
16251625
16261626
assert_eq!(from_str("null"), Ok(Null));
16271627
assert_eq!(from_str("true"), Ok(Boolean(true)));
@@ -1649,20 +1649,20 @@ mod tests {
16491649
#[test]
16501650
fn test_read_number() {
16511651
assert_eq!(from_str("+"),
1652-
Err(Error {line: 1u, col: 1u, msg: @~"invalid syntax"}));
1652+
Err(Error {line: 1u, col: 1u, msg: ~"invalid syntax"}));
16531653
assert_eq!(from_str("."),
1654-
Err(Error {line: 1u, col: 1u, msg: @~"invalid syntax"}));
1654+
Err(Error {line: 1u, col: 1u, msg: ~"invalid syntax"}));
16551655
16561656
assert_eq!(from_str("-"),
1657-
Err(Error {line: 1u, col: 2u, msg: @~"invalid number"}));
1657+
Err(Error {line: 1u, col: 2u, msg: ~"invalid number"}));
16581658
assert_eq!(from_str("00"),
1659-
Err(Error {line: 1u, col: 2u, msg: @~"invalid number"}));
1659+
Err(Error {line: 1u, col: 2u, msg: ~"invalid number"}));
16601660
assert_eq!(from_str("1."),
1661-
Err(Error {line: 1u, col: 3u, msg: @~"invalid number"}));
1661+
Err(Error {line: 1u, col: 3u, msg: ~"invalid number"}));
16621662
assert_eq!(from_str("1e"),
1663-
Err(Error {line: 1u, col: 3u, msg: @~"invalid number"}));
1663+
Err(Error {line: 1u, col: 3u, msg: ~"invalid number"}));
16641664
assert_eq!(from_str("1e+"),
1665-
Err(Error {line: 1u, col: 4u, msg: @~"invalid number"}));
1665+
Err(Error {line: 1u, col: 4u, msg: ~"invalid number"}));
16661666
16671667
assert_eq!(from_str("3"), Ok(Number(3.0)));
16681668
assert_eq!(from_str("3.1"), Ok(Number(3.1)));
@@ -1708,10 +1708,10 @@ mod tests {
17081708
#[test]
17091709
fn test_read_str() {
17101710
assert_eq!(from_str("\""),
1711-
Err(Error {line: 1u, col: 2u, msg: @~"EOF while parsing string"
1711+
Err(Error {line: 1u, col: 2u, msg: ~"EOF while parsing string"
17121712
}));
17131713
assert_eq!(from_str("\"lol"),
1714-
Err(Error {line: 1u, col: 5u, msg: @~"EOF while parsing string"
1714+
Err(Error {line: 1u, col: 5u, msg: ~"EOF while parsing string"
17151715
}));
17161716
17171717
assert_eq!(from_str("\"\""), Ok(String(~"")));
@@ -1768,15 +1768,15 @@ mod tests {
17681768
#[test]
17691769
fn test_read_list() {
17701770
assert_eq!(from_str("["),
1771-
Err(Error {line: 1u, col: 2u, msg: @~"EOF while parsing value"}));
1771+
Err(Error {line: 1u, col: 2u, msg: ~"EOF while parsing value"}));
17721772
assert_eq!(from_str("[1"),
1773-
Err(Error {line: 1u, col: 3u, msg: @~"EOF while parsing list"}));
1773+
Err(Error {line: 1u, col: 3u, msg: ~"EOF while parsing list"}));
17741774
assert_eq!(from_str("[1,"),
1775-
Err(Error {line: 1u, col: 4u, msg: @~"EOF while parsing value"}));
1775+
Err(Error {line: 1u, col: 4u, msg: ~"EOF while parsing value"}));
17761776
assert_eq!(from_str("[1,]"),
1777-
Err(Error {line: 1u, col: 4u, msg: @~"invalid syntax"}));
1777+
Err(Error {line: 1u, col: 4u, msg: ~"invalid syntax"}));
17781778
assert_eq!(from_str("[6 7]"),
1779-
Err(Error {line: 1u, col: 4u, msg: @~"expected `,` or `]`"}));
1779+
Err(Error {line: 1u, col: 4u, msg: ~"expected `,` or `]`"}));
17801780

17811781
assert_eq!(from_str("[]"), Ok(List(~[])));
17821782
assert_eq!(from_str("[ ]"), Ok(List(~[])));
@@ -1824,49 +1824,49 @@ mod tests {
18241824
Err(Error {
18251825
line: 1u,
18261826
col: 2u,
1827-
msg: @~"EOF while parsing object"}));
1827+
msg: ~"EOF while parsing object"}));
18281828
assert_eq!(from_str("{ "),
18291829
Err(Error {
18301830
line: 1u,
18311831
col: 3u,
1832-
msg: @~"EOF while parsing object"}));
1832+
msg: ~"EOF while parsing object"}));
18331833
assert_eq!(from_str("{1"),
18341834
Err(Error {
18351835
line: 1u,
18361836
col: 2u,
1837-
msg: @~"key must be a string"}));
1837+
msg: ~"key must be a string"}));
18381838
assert_eq!(from_str("{ \"a\""),
18391839
Err(Error {
18401840
line: 1u,
18411841
col: 6u,
1842-
msg: @~"EOF while parsing object"}));
1842+
msg: ~"EOF while parsing object"}));
18431843
assert_eq!(from_str("{\"a\""),
18441844
Err(Error {
18451845
line: 1u,
18461846
col: 5u,
1847-
msg: @~"EOF while parsing object"}));
1847+
msg: ~"EOF while parsing object"}));
18481848
assert_eq!(from_str("{\"a\" "),
18491849
Err(Error {
18501850
line: 1u,
18511851
col: 6u,
1852-
msg: @~"EOF while parsing object"}));
1852+
msg: ~"EOF while parsing object"}));
18531853
18541854
assert_eq!(from_str("{\"a\" 1"),
1855-
Err(Error {line: 1u, col: 6u, msg: @~"expected `:`"}));
1855+
Err(Error {line: 1u, col: 6u, msg: ~"expected `:`"}));
18561856
assert_eq!(from_str("{\"a\":"),
1857-
Err(Error {line: 1u, col: 6u, msg: @~"EOF while parsing value"}));
1857+
Err(Error {line: 1u, col: 6u, msg: ~"EOF while parsing value"}));
18581858
assert_eq!(from_str("{\"a\":1"),
18591859
Err(Error {
18601860
line: 1u,
18611861
col: 7u,
1862-
msg: @~"EOF while parsing object"}));
1862+
msg: ~"EOF while parsing object"}));
18631863
assert_eq!(from_str("{\"a\":1 1"),
1864-
Err(Error {line: 1u, col: 8u, msg: @~"expected `,` or `}`"}));
1864+
Err(Error {line: 1u, col: 8u, msg: ~"expected `,` or `}`"}));
18651865
assert_eq!(from_str("{\"a\":1,"),
18661866
Err(Error {
18671867
line: 1u,
18681868
col: 8u,
1869-
msg: @~"EOF while parsing object"}));
1869+
msg: ~"EOF while parsing object"}));
18701870
18711871
assert_eq!(from_str("{}").unwrap(), mk_object([]));
18721872
assert_eq!(from_str("{\"a\": 3}").unwrap(),
@@ -1966,7 +1966,7 @@ mod tests {
19661966
Err(Error {
19671967
line: 3u,
19681968
col: 8u,
1969-
msg: @~"EOF while parsing object"}));
1969+
msg: ~"EOF while parsing object"}));
19701970
}
19711971
19721972
#[deriving(Decodable)]

0 commit comments

Comments
 (0)