Skip to content

Commit

Permalink
libcollections: deny warnings in doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryman committed Nov 12, 2015
1 parent 89a8203 commit bbf964a
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/libcollections/binary_heap.rs
Expand Up @@ -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]);
Expand Down
1 change: 1 addition & 0 deletions src/libcollections/borrow.rs
Expand Up @@ -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];
Expand Down
1 change: 1 addition & 0 deletions src/libcollections/btree/set.rs
Expand Up @@ -89,6 +89,7 @@ impl<T: Ord> BTreeSet<T> {
/// # Examples
///
/// ```
/// # #![allow(unused_mut)]
/// use std::collections::BTreeSet;
///
/// let mut set: BTreeSet<i32> = BTreeSet::new();
Expand Down
3 changes: 2 additions & 1 deletion src/libcollections/fmt.rs
Expand Up @@ -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 {
Expand All @@ -174,7 +175,6 @@
//! like:
//!
//! ```
//! #![feature(fmt_flags)]
//! use std::fmt;
//!
//! #[derive(Debug)]
Expand Down Expand Up @@ -288,6 +288,7 @@
//! off, some example usage is:
//!
//! ```
//! # #![allow(unused_must_use)]
//! use std::fmt;
//! use std::io::{self, Write};
//!
Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/lib.rs
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/libcollections/slice.rs
Expand Up @@ -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")]
Expand Down
10 changes: 4 additions & 6 deletions src/libcollections/str.rs
Expand Up @@ -298,7 +298,7 @@ impl str {
/// done by `.chars()` or `.char_indices()`.
///
/// ```
/// #![feature(str_char, core)]
/// #![feature(str_char)]
///
/// use std::str::CharRange;
///
Expand Down Expand Up @@ -358,7 +358,7 @@ impl str {
/// done by `.chars().rev()` or `.char_indices()`.
///
/// ```
/// #![feature(str_char, core)]
/// #![feature(str_char)]
///
/// use std::str::CharRange;
///
Expand Down Expand Up @@ -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();
///
Expand All @@ -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();
///
Expand Down Expand Up @@ -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")]);
///
Expand Down Expand Up @@ -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")]);
///
Expand Down
15 changes: 15 additions & 0 deletions src/libcollections/string.rs
Expand Up @@ -55,6 +55,7 @@ impl String {
/// # Examples
///
/// ```
/// # #![allow(unused_mut)]
/// let mut s = String::new();
/// ```
#[inline]
Expand All @@ -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")]
Expand Down
1 change: 1 addition & 0 deletions src/libcollections/vec.rs
Expand Up @@ -242,6 +242,7 @@ impl<T> Vec<T> {
/// # Examples
///
/// ```
/// # #![allow(unused_mut)]
/// let mut vec: Vec<i32> = Vec::new();
/// ```
#[inline]
Expand Down

0 comments on commit bbf964a

Please sign in to comment.