1
Fork 0

Replace all uses of &foo[] with &foo[..] en masse.

This commit is contained in:
Niko Matsakis 2015-02-18 14:48:57 -05:00
parent 64cd30e0ca
commit 9ea84aeed4
145 changed files with 865 additions and 864 deletions

View file

@ -1120,7 +1120,7 @@ impl Json {
/// Returns None otherwise.
pub fn as_string<'a>(&'a self) -> Option<&'a str> {
match *self {
Json::String(ref s) => Some(&s[]),
Json::String(ref s) => Some(&s[..]),
_ => None
}
}
@ -2237,7 +2237,7 @@ impl ::Decoder for Decoder {
return Err(ExpectedError("String or Object".to_string(), format!("{}", json)))
}
};
let idx = match names.iter().position(|n| *n == &name[]) {
let idx = match names.iter().position(|n| *n == &name[..]) {
Some(idx) => idx,
None => return Err(UnknownVariantError(name))
};
@ -3461,7 +3461,7 @@ mod tests {
hm.insert(1, true);
let mut mem_buf = Vec::new();
write!(&mut mem_buf, "{}", super::as_pretty_json(&hm)).unwrap();
let json_str = from_utf8(&mem_buf[]).unwrap();
let json_str = from_utf8(&mem_buf[..]).unwrap();
match from_str(json_str) {
Err(_) => panic!("Unable to parse json_str: {:?}", json_str),
_ => {} // it parsed and we are good to go
@ -3477,7 +3477,7 @@ mod tests {
hm.insert(1, true);
let mut mem_buf = Vec::new();
write!(&mut mem_buf, "{}", super::as_pretty_json(&hm)).unwrap();
let json_str = from_utf8(&mem_buf[]).unwrap();
let json_str = from_utf8(&mem_buf[..]).unwrap();
match from_str(json_str) {
Err(_) => panic!("Unable to parse json_str: {:?}", json_str),
_ => {} // it parsed and we are good to go
@ -3517,7 +3517,7 @@ mod tests {
write!(&mut writer, "{}",
super::as_pretty_json(&json).indent(i)).unwrap();
let printed = from_utf8(&writer[]).unwrap();
let printed = from_utf8(&writer[..]).unwrap();
// Check for indents at each line
let lines: Vec<&str> = printed.lines().collect();
@ -3549,7 +3549,7 @@ mod tests {
let mut map = HashMap::new();
map.insert(Enum::Foo, 0);
let result = json::encode(&map).unwrap();
assert_eq!(&result[], r#"{"Foo":0}"#);
assert_eq!(&result[..], r#"{"Foo":0}"#);
let decoded: HashMap<Enum, _> = json::decode(&result).unwrap();
assert_eq!(map, decoded);
}