rollup merge of #22502: nikomatsakis/deprecate-bracket-bracket
Conflicts: src/libcollections/slice.rs src/libcollections/str.rs src/librustc/middle/lang_items.rs src/librustc_back/rpath.rs src/librustc_typeck/check/regionck.rs src/libstd/ffi/os_str.rs src/libsyntax/diagnostic.rs src/libsyntax/parse/parser.rs src/libsyntax/util/interner.rs src/test/run-pass/regions-refcell.rs
This commit is contained in:
commit
231eeaa35b
146 changed files with 895 additions and 882 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue