diff options
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/entry.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/base.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 7 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/symbol.rs | 32 |
6 files changed, 7 insertions, 40 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 8a238a11281..bb07efdd9e7 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -373,7 +373,7 @@ impl Generics { } pub fn span_for_name(&self, name: &str) -> Option<Span> { for t in &self.ty_params { - if t.ident.name.as_str() == name { + if t.ident.name == name { return Some(t.span); } } diff --git a/src/libsyntax/entry.rs b/src/libsyntax/entry.rs index 7014e576e2b..93ca1948ed8 100644 --- a/src/libsyntax/entry.rs +++ b/src/libsyntax/entry.rs @@ -28,7 +28,7 @@ pub fn entry_point_type(item: &Item, depth: usize) -> EntryPointType { EntryPointType::Start } else if attr::contains_name(&item.attrs, "main") { EntryPointType::MainAttr - } else if item.ident.name.as_str() == "main" { + } else if item.ident.name == "main" { if depth == 1 { // This is a top-level function so can be 'main' EntryPointType::MainNamed diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 1dda5e3ba06..ddf4cf11f20 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -643,7 +643,7 @@ impl<'a> ExtCtxt<'a> { loop { if self.codemap().with_expn_info(expn_id, |info| { info.map_or(None, |i| { - if i.callee.name().as_str() == "include" { + if i.callee.name() == "include" { // Stop going up the backtrace once include! is encountered return None; } diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 4c37a0a71e2..59b8b50e88c 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -791,8 +791,7 @@ fn is_in_follow(tok: &Token, frag: &str) -> Result<bool, (String, &'static str)> "pat" => { match *tok { FatArrow | Comma | Eq | BinOp(token::Or) => Ok(true), - Ident(i) if (i.name.as_str() == "if" || - i.name.as_str() == "in") => Ok(true), + Ident(i) if i.name == "if" || i.name == "in" => Ok(true), _ => Ok(false) } }, @@ -800,8 +799,8 @@ fn is_in_follow(tok: &Token, frag: &str) -> Result<bool, (String, &'static str)> match *tok { OpenDelim(token::DelimToken::Brace) | OpenDelim(token::DelimToken::Bracket) | Comma | FatArrow | Colon | Eq | Gt | Semi | BinOp(token::Or) => Ok(true), - MatchNt(_, ref frag) if frag.name.as_str() == "block" => Ok(true), - Ident(i) if i.name.as_str() == "as" || i.name.as_str() == "where" => Ok(true), + MatchNt(_, ref frag) if frag.name == "block" => Ok(true), + Ident(i) if i.name == "as" || i.name == "where" => Ok(true), _ => Ok(false) } }, diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index be1abf9cc83..4997e464c2b 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2535,7 +2535,7 @@ impl<'a> Parser<'a> { let prev_span = self.prev_span; let fstr = n.as_str(); let mut err = self.diagnostic().struct_span_err(prev_span, - &format!("unexpected token: `{}`", n.as_str())); + &format!("unexpected token: `{}`", n)); if fstr.chars().all(|x| "0123456789.".contains(x)) { let float = match fstr.parse::<f64>().ok() { Some(f) => f, diff --git a/src/libsyntax/symbol.rs b/src/libsyntax/symbol.rs index 4095845f8d9..f7217b9535f 100644 --- a/src/libsyntax/symbol.rs +++ b/src/libsyntax/symbol.rs @@ -244,14 +244,6 @@ pub struct InternedString { string: Rc<str>, } -impl InternedString { - pub fn new(string: &'static str) -> InternedString { - InternedString { - string: Rc::__from_str(string), - } - } -} - impl ::std::ops::Deref for InternedString { type Target = str; fn deref(&self) -> &str { &self.string } @@ -269,30 +261,6 @@ impl fmt::Display for InternedString { } } -impl<'a> PartialEq<&'a str> for InternedString { - fn eq(&self, other: & &'a str) -> bool { - PartialEq::eq(&self.string[..], *other) - } -} - -impl<'a> PartialEq<InternedString> for &'a str { - fn eq(&self, other: &InternedString) -> bool { - PartialEq::eq(*self, &other.string[..]) - } -} - -impl PartialEq<str> for InternedString { - fn eq(&self, other: &str) -> bool { - PartialEq::eq(&self.string[..], other) - } -} - -impl PartialEq<InternedString> for str { - fn eq(&self, other: &InternedString) -> bool { - PartialEq::eq(self, &other.string[..]) - } -} - impl Decodable for InternedString { fn decode<D: Decoder>(d: &mut D) -> Result<InternedString, D::Error> { Ok(Symbol::intern(&d.read_str()?).as_str()) |
