Replace the get method by the deref one on InternedString

This commit is contained in:
GuillaumeGomez
2015-02-03 00:23:08 +01:00
parent 966e6c0c37
commit d58c0a7597
24 changed files with 123 additions and 104 deletions

View File

@@ -84,6 +84,7 @@ use std::mem;
use std::num::Float;
use std::rc::Rc;
use std::slice;
use std::ops::Deref;
bitflags! {
flags Restrictions: u8 {
@@ -5133,7 +5134,7 @@ impl<'a> Parser<'a> {
outer_attrs, "path") {
Some(d) => (dir_path.join(d), true),
None => {
let mod_name = mod_string.get().to_string();
let mod_name = mod_string.deref().to_string();
let default_path_str = format!("{}.rs", mod_name);
let secondary_path_str = format!("{}/mod.rs", mod_name);
let default_path = dir_path.join(&default_path_str[]);
@@ -5145,7 +5146,7 @@ impl<'a> Parser<'a> {
self.span_err(id_sp,
"cannot declare a new module at this location");
let this_module = match self.mod_path_stack.last() {
Some(name) => name.get().to_string(),
Some(name) => name.deref().to_string(),
None => self.root_module_name.as_ref().unwrap().clone(),
};
self.span_note(id_sp,
@@ -5191,7 +5192,7 @@ impl<'a> Parser<'a> {
};
self.eval_src_mod_from_path(file_path, owns_directory,
mod_string.get().to_string(), id_sp)
mod_string.deref().to_string(), id_sp)
}
fn eval_src_mod_from_path(&mut self,

View File

@@ -625,19 +625,6 @@ impl InternedString {
string: string,
}
}
#[inline]
#[deprecated = "use as_slice() instead"]
pub fn get<'a>(&'a self) -> &'a str {
&self.string[]
}
}
impl Str for InternedString {
#[inline]
fn as_slice<'a>(&'a self) -> &'a str {
&self.string[]
}
}
impl Deref for InternedString {
@@ -652,7 +639,7 @@ impl BytesContainer for InternedString {
// of `BytesContainer`, which is itself a workaround for the lack of
// DST.
unsafe {
let this = self.get();
let this = self.deref();
mem::transmute::<&[u8],&[u8]>(this.container_as_bytes())
}
}