libcollections: deny warnings in doctests
This commit is contained in:
parent
89a8203898
commit
bbf964afea
@ -233,6 +233,7 @@ impl<T: Ord> 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 @@ impl<T> ToOwned for T where T: 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 @@ impl str {
|
||||
/// done by `.chars()` or `.char_indices()`.
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(str_char, core)]
|
||||
/// #![feature(str_char)]
|
||||
///
|
||||
/// use std::str::CharRange;
|
||||
///
|
||||
@ -358,7 +358,7 @@ impl str {
|
||||
/// done by `.chars().rev()` or `.char_indices()`.
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(str_char, core)]
|
||||
/// #![feature(str_char)]
|
||||
///
|
||||
/// use std::str::CharRange;
|
||||
///
|
||||
@ -634,6 +634,7 @@ impl str {
|
||||
/// # 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 @@ impl str {
|
||||
/// 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 @@ impl str {
|
||||
/// # 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 @@ impl str {
|
||||
/// # 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 @@ impl 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]
|
||||
|
Loading…
Reference in New Issue
Block a user