提交 bbf964af 编写于 作者: K Kevin Butler

libcollections: deny warnings in doctests

上级 89a82038
......@@ -233,6 +233,7 @@ pub fn with_capacity(capacity: usize) -> BinaryHeap<T> {
///
/// ```
/// #![feature(binary_heap_extras)]
/// # #![allow(deprecated)]
///
/// use std::collections::BinaryHeap;
/// let heap = BinaryHeap::from_vec(vec![9, 1, 2, 7, 3, 2]);
......
......@@ -72,6 +72,7 @@ fn to_owned(&self) -> T { self.clone() }
/// ```
/// use std::borrow::Cow;
///
/// # #[allow(dead_code)]
/// fn abs_all(input: &mut Cow<[i32]>) {
/// for i in 0..input.len() {
/// let v = input[i];
......
......@@ -89,6 +89,7 @@ impl<T: Ord> BTreeSet<T> {
/// # Examples
///
/// ```
/// # #![allow(unused_mut)]
/// use std::collections::BTreeSet;
///
/// let mut set: BTreeSet<i32> = BTreeSet::new();
......
......@@ -150,6 +150,7 @@
//! implement a method of the signature:
//!
//! ```
//! # #![allow(dead_code)]
//! # use std::fmt;
//! # struct Foo; // our custom type
//! # impl fmt::Display for Foo {
......@@ -174,7 +175,6 @@
//! like:
//!
//! ```
//! #![feature(fmt_flags)]
//! use std::fmt;
//!
//! #[derive(Debug)]
......@@ -288,6 +288,7 @@
//! off, some example usage is:
//!
//! ```
//! # #![allow(unused_must_use)]
//! use std::fmt;
//! use std::io::{self, Write};
//!
......
......@@ -27,7 +27,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/",
html_playground_url = "https://play.rust-lang.org/",
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
test(no_crate_inject))]
test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]
#![allow(trivial_casts)]
#![cfg_attr(test, allow(deprecated))] // rand
......
......@@ -852,6 +852,7 @@ pub trait SliceConcatExt<T: ?Sized> {
/// # Examples
///
/// ```
/// # #![allow(deprecated)]
/// assert_eq!(["hello", "world"].connect(" "), "hello world");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
......
......@@ -298,7 +298,7 @@ pub unsafe fn slice_mut_unchecked(&mut self, begin: usize, end: usize) -> &mut s
/// done by `.chars()` or `.char_indices()`.
///
/// ```
/// #![feature(str_char, core)]
/// #![feature(str_char)]
///
/// use std::str::CharRange;
///
......@@ -358,7 +358,7 @@ pub fn char_range_at(&self, start: usize) -> CharRange {
/// done by `.chars().rev()` or `.char_indices()`.
///
/// ```
/// #![feature(str_char, core)]
/// #![feature(str_char)]
///
/// use std::str::CharRange;
///
......@@ -634,6 +634,7 @@ pub fn lines(&self) -> Lines {
/// # Examples
///
/// ```
/// # #![allow(deprecated)]
/// let four_lines = "foo\r\nbar\n\r\nbaz";
/// let v: Vec<&str> = four_lines.lines_any().collect();
///
......@@ -643,6 +644,7 @@ pub fn lines(&self) -> Lines {
/// Leaving off the trailing character:
///
/// ```
/// # #![allow(deprecated)]
/// let four_lines = "foo\r\nbar\n\r\nbaz\n";
/// let v: Vec<&str> = four_lines.lines_any().collect();
///
......@@ -1179,8 +1181,6 @@ pub fn rmatches<'a, P: Pattern<'a>>(&'a self, pat: P) -> RMatches<'a, P>
/// # Examples
///
/// ```
/// #![feature(str_match_indices)]
///
/// let v: Vec<_> = "abcXXXabcYYYabc".match_indices("abc").collect();
/// assert_eq!(v, [(0, "abc"), (6, "abc"), (12, "abc")]);
///
......@@ -1216,8 +1216,6 @@ pub fn match_indices<'a, P: Pattern<'a>>(&'a self, pat: P) -> MatchIndices<'a, P
/// # Examples
///
/// ```
/// #![feature(str_match_indices)]
///
/// let v: Vec<_> = "abcXXXabcYYYabc".rmatch_indices("abc").collect();
/// assert_eq!(v, [(12, "abc"), (6, "abc"), (0, "abc")]);
///
......
......@@ -55,6 +55,7 @@ impl String {
/// # Examples
///
/// ```
/// # #![allow(unused_mut)]
/// let mut s = String::new();
/// ```
#[inline]
......@@ -73,6 +74,20 @@ pub fn new() -> String {
///
/// ```
/// let mut s = String::with_capacity(10);
///
/// // The String contains no chars, even though it has capacity for more
/// assert_eq!(s.len(), 0);
///
/// // These are all done without reallocating...
/// let cap = s.capacity();
/// for i in 0..10 {
/// s.push('a');
/// }
///
/// assert_eq!(s.capacity(), cap);
///
/// // ...but this may make the vector reallocate
/// s.push('a');
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
......
......@@ -242,6 +242,7 @@ impl<T> Vec<T> {
/// # Examples
///
/// ```
/// # #![allow(unused_mut)]
/// let mut vec: Vec<i32> = Vec::new();
/// ```
#[inline]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册