remove some compiler warnings
This commit is contained in:
parent
610d1695d1
commit
8b2ff472cf
@ -2663,7 +2663,7 @@ mod tests {
|
||||
let (left, right) = values.split_at_mut(2);
|
||||
{
|
||||
let left: &[_] = left;
|
||||
assert!(left[..left.len()] == [1, 2][]);
|
||||
assert!(left[..left.len()] == [1, 2]);
|
||||
}
|
||||
for p in left {
|
||||
*p += 1;
|
||||
@ -2671,7 +2671,7 @@ mod tests {
|
||||
|
||||
{
|
||||
let right: &[_] = right;
|
||||
assert!(right[..right.len()] == [3, 4, 5][]);
|
||||
assert!(right[..right.len()] == [3, 4, 5]);
|
||||
}
|
||||
for p in right {
|
||||
*p += 2;
|
||||
|
@ -2090,7 +2090,7 @@ mod tests {
|
||||
let (left, right) = values.split_at_mut(2);
|
||||
{
|
||||
let left: &[_] = left;
|
||||
assert!(&left[..left.len()] == &[1, 2][]);
|
||||
assert!(&left[..left.len()] == &[1, 2]);
|
||||
}
|
||||
for p in left {
|
||||
*p += 1;
|
||||
@ -2098,7 +2098,7 @@ mod tests {
|
||||
|
||||
{
|
||||
let right: &[_] = right;
|
||||
assert!(&right[..right.len()] == &[3, 4, 5][]);
|
||||
assert!(&right[..right.len()] == &[3, 4, 5]);
|
||||
}
|
||||
for p in right {
|
||||
*p += 2;
|
||||
|
@ -59,16 +59,16 @@ fn iterator_to_slice() {
|
||||
let mut iter = data.iter_mut();
|
||||
assert_eq!(&iter[..], &other_data[..]);
|
||||
// mutability:
|
||||
assert!(&mut iter[] == other_data);
|
||||
assert!(&mut iter[..] == other_data);
|
||||
|
||||
iter.next();
|
||||
assert_eq!(&iter[..], &other_data[1..]);
|
||||
assert!(&mut iter[] == &mut other_data[1..]);
|
||||
assert!(&mut iter[..] == &mut other_data[1..]);
|
||||
|
||||
iter.next_back();
|
||||
|
||||
assert_eq!(&iter[..], &other_data[1..2]);
|
||||
assert!(&mut iter[] == &mut other_data[1..2]);
|
||||
assert!(&mut iter[..] == &mut other_data[1..2]);
|
||||
|
||||
let s = iter.into_slice();
|
||||
assert!(s == &mut other_data[1..2]);
|
||||
|
@ -68,7 +68,7 @@ pub fn ast_ty_to_prim_ty<'tcx>(tcx: &ty::ctxt<'tcx>, ast_ty: &ast::Ty)
|
||||
Some(d) => d.full_def()
|
||||
};
|
||||
if let def::DefPrimTy(nty) = def {
|
||||
Some(prim_ty_to_ty(tcx, &path.segments[], nty))
|
||||
Some(prim_ty_to_ty(tcx, &path.segments, nty))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
@ -76,4 +76,3 @@ pub fn ast_ty_to_prim_ty<'tcx>(tcx: &ty::ctxt<'tcx>, ast_ty: &ast::Ty)
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2985,7 +2985,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
} else {
|
||||
let msg = format!("use of undeclared trait name `{}`",
|
||||
self.path_names_to_string(trait_path, path_depth));
|
||||
self.resolve_error(trait_path.span, &msg[]);
|
||||
self.resolve_error(trait_path.span, &msg);
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
|
@ -3945,9 +3945,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_encode_hashmap_with_arbitrary_key() {
|
||||
use std::old_io::Writer;
|
||||
use std::collections::HashMap;
|
||||
use std::fmt;
|
||||
#[derive(PartialEq, Eq, Hash, RustcEncodable)]
|
||||
struct ArbitraryType(uint);
|
||||
let mut hm: HashMap<ArbitraryType, bool> = HashMap::new();
|
||||
|
@ -173,7 +173,7 @@ mod tests {
|
||||
assert_eq!(writer.write(&[1, 2, 3]), Ok(3));
|
||||
assert_eq!(writer.write(&[4, 5, 6, 7]), Ok(4));
|
||||
let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7];
|
||||
assert_eq!(&writer.get_ref()[], b);
|
||||
assert_eq!(&writer.get_ref()[..], b);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -369,28 +369,28 @@ mod tests {
|
||||
assert_eq!(writer.write(&[4, 5, 6, 7]), Ok(4));
|
||||
assert_eq!(writer.position(), 8);
|
||||
let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7];
|
||||
assert_eq!(&writer.get_ref()[], b);
|
||||
assert_eq!(&writer.get_ref()[..], b);
|
||||
|
||||
assert_eq!(writer.seek(SeekFrom::Start(0)), Ok(0));
|
||||
assert_eq!(writer.position(), 0);
|
||||
assert_eq!(writer.write(&[3, 4]), Ok(2));
|
||||
let b: &[_] = &[3, 4, 2, 3, 4, 5, 6, 7];
|
||||
assert_eq!(&writer.get_ref()[], b);
|
||||
assert_eq!(&writer.get_ref()[..], b);
|
||||
|
||||
assert_eq!(writer.seek(SeekFrom::Current(1)), Ok(3));
|
||||
assert_eq!(writer.write(&[0, 1]), Ok(2));
|
||||
let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 7];
|
||||
assert_eq!(&writer.get_ref()[], b);
|
||||
assert_eq!(&writer.get_ref()[..], b);
|
||||
|
||||
assert_eq!(writer.seek(SeekFrom::End(-1)), Ok(7));
|
||||
assert_eq!(writer.write(&[1, 2]), Ok(2));
|
||||
let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 1, 2];
|
||||
assert_eq!(&writer.get_ref()[], b);
|
||||
assert_eq!(&writer.get_ref()[..], b);
|
||||
|
||||
assert_eq!(writer.seek(SeekFrom::End(1)), Ok(10));
|
||||
assert_eq!(writer.write(&[1]), Ok(1));
|
||||
let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 1, 2, 0, 1];
|
||||
assert_eq!(&writer.get_ref()[], b);
|
||||
assert_eq!(&writer.get_ref()[..], b);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -760,13 +760,13 @@ mod test {
|
||||
#[test] fn idents_name_eq_test() {
|
||||
assert!(segments_name_eq(
|
||||
&[Ident{name:Name(3),ctxt:4}, Ident{name:Name(78),ctxt:82}]
|
||||
.iter().map(ident_to_segment).collect::<Vec<PathSegment>>()[],
|
||||
.iter().map(ident_to_segment).collect::<Vec<PathSegment>>(),
|
||||
&[Ident{name:Name(3),ctxt:104}, Ident{name:Name(78),ctxt:182}]
|
||||
.iter().map(ident_to_segment).collect::<Vec<PathSegment>>()[]));
|
||||
.iter().map(ident_to_segment).collect::<Vec<PathSegment>>()));
|
||||
assert!(!segments_name_eq(
|
||||
&[Ident{name:Name(3),ctxt:4}, Ident{name:Name(78),ctxt:82}]
|
||||
.iter().map(ident_to_segment).collect::<Vec<PathSegment>>()[],
|
||||
.iter().map(ident_to_segment).collect::<Vec<PathSegment>>(),
|
||||
&[Ident{name:Name(3),ctxt:104}, Ident{name:Name(77),ctxt:182}]
|
||||
.iter().map(ident_to_segment).collect::<Vec<PathSegment>>()[]));
|
||||
.iter().map(ident_to_segment).collect::<Vec<PathSegment>>()));
|
||||
}
|
||||
}
|
||||
|
@ -114,12 +114,12 @@ pub fn parse_summary<R: Reader>(input: R, src: &Path) -> Result<Book, Vec<String
|
||||
}
|
||||
};
|
||||
|
||||
let star_idx = match line.find_str("*") { Some(i) => i, None => continue };
|
||||
let star_idx = match line.find("*") { Some(i) => i, None => continue };
|
||||
|
||||
let start_bracket = star_idx + line[star_idx..].find_str("[").unwrap();
|
||||
let end_bracket = start_bracket + line[start_bracket..].find_str("](").unwrap();
|
||||
let start_bracket = star_idx + line[star_idx..].find("[").unwrap();
|
||||
let end_bracket = start_bracket + line[start_bracket..].find("](").unwrap();
|
||||
let start_paren = end_bracket + 1;
|
||||
let end_paren = start_paren + line[start_paren..].find_str(")").unwrap();
|
||||
let end_paren = start_paren + line[start_paren..].find(")").unwrap();
|
||||
|
||||
let given_path = &line[start_paren + 1 .. end_paren];
|
||||
let title = line[start_bracket + 1..end_bracket].to_string();
|
||||
|
Loading…
Reference in New Issue
Block a user