]> git.lizzy.rs Git - rust.git/blobdiff - src/libsyntax/parse/lexer/comments.rs
remove unnecessary parentheses from range notation
[rust.git] / src / libsyntax / parse / lexer / comments.rs
index b8da8365f7e236a979af9dd199e995bb433d00c4..79a85e9afbd1f8952486ea383b95805f7c0619b8 100644 (file)
@@ -24,7 +24,7 @@
 use std::string::String;
 use std::uint;
 
-#[deriving(Clone, Copy, PartialEq)]
+#[derive(Clone, Copy, PartialEq)]
 pub enum CommentStyle {
     /// No code on either side of each line of the comment
     Isolated,
@@ -36,7 +36,7 @@ pub enum CommentStyle {
     BlankLine,
 }
 
-#[deriving(Clone)]
+#[derive(Clone)]
 pub struct Comment {
     pub style: CommentStyle,
     pub lines: Vec<String>,
@@ -116,7 +116,7 @@ fn horizontal_trim(lines: Vec<String> ) -> Vec<String> {
 
         if can_trim {
             lines.iter().map(|line| {
-                line[i + 1..line.len()].to_string()
+                (&line[i + 1..line.len()]).to_string()
             }).collect()
         } else {
             lines
@@ -127,7 +127,7 @@ fn horizontal_trim(lines: Vec<String> ) -> Vec<String> {
     static ONLINERS: &'static [&'static str] = &["///!", "///", "//!", "//"];
     for prefix in ONLINERS.iter() {
         if comment.starts_with(*prefix) {
-            return comment[prefix.len()..].to_string();
+            return (&comment[prefix.len()..]).to_string();
         }
     }
 
@@ -187,7 +187,7 @@ fn read_line_comments(rdr: &mut StringReader, code_to_the_left: bool,
         let line = rdr.read_one_line_comment();
         debug!("{}", line);
         // Doc comments are not put in comments.
-        if is_doc_comment(line[]) {
+        if is_doc_comment(&line[]) {
             break;
         }
         lines.push(line);
@@ -224,10 +224,10 @@ fn all_whitespace(s: &str, col: CharPos) -> Option<uint> {
 fn trim_whitespace_prefix_and_push_line(lines: &mut Vec<String> ,
                                         s: String, col: CharPos) {
     let len = s.len();
-    let s1 = match all_whitespace(s[], col) {
+    let s1 = match all_whitespace(&s[], col) {
         Some(col) => {
             if col < len {
-                s[col..len].to_string()
+                (&s[col..len]).to_string()
             } else {
                 "".to_string()
             }
@@ -261,7 +261,7 @@ fn read_block_comment(rdr: &mut StringReader,
             rdr.bump();
             rdr.bump();
         }
-        if is_block_doc_comment(curr_line[]) {
+        if is_block_doc_comment(&curr_line[]) {
             return
         }
         assert!(!curr_line.contains_char('\n'));
@@ -327,7 +327,7 @@ fn consume_comment(rdr: &mut StringReader,
     debug!("<<< consume comment");
 }
 
-#[deriving(Clone)]
+#[derive(Clone)]
 pub struct Literal {
     pub lit: String,
     pub pos: BytePos,