]> git.lizzy.rs Git - rust.git/commitdiff
Replace &Rc<String> with &str
authorSeiichi Uchida <seuchida@gmail.com>
Thu, 7 Dec 2017 08:32:19 +0000 (17:32 +0900)
committerSeiichi Uchida <seuchida@gmail.com>
Thu, 7 Dec 2017 08:32:19 +0000 (17:32 +0900)
src/visitor.rs

index f2b4750460f80e553b2a87d07c32124beec51480..bc4be2131b7f9e23d972b71655f3ebe6ba448223 100644 (file)
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::rc::Rc;
 use std::cmp;
 
 use strings::string_buffer::StringBuffer;
@@ -51,7 +50,7 @@ fn is_extern_crate(item: &ast::Item) -> bool {
 /// Creates a string slice corresponding to the specified span.
 pub struct SnippetProvider<'a> {
     /// A pointer to the content of the file we are formatting.
-    big_snippet: &'a Rc<String>,
+    big_snippet: &'a str,
     /// A position of the start of `big_snippet`, used as an offset.
     start_pos: usize,
 }
@@ -63,7 +62,7 @@ pub fn span_to_snippet(&'b self, span: Span) -> Option<&'a str> {
         Some(&self.big_snippet[start_index..end_index])
     }
 
-    pub fn new(start_pos: BytePos, big_snippet: &'a Rc<String>) -> Self {
+    pub fn new(start_pos: BytePos, big_snippet: &'a str) -> Self {
         let start_pos = start_pos.to_usize();
         SnippetProvider {
             big_snippet,