Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
82784cb8
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
82784cb8
编写于
11月 03, 2015
作者:
K
Kevin Butler
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
libcore: deny warnings in doctests
上级
bbf964af
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
48 addition
and
10 deletion
+48
-10
src/libcore/cell.rs
src/libcore/cell.rs
+3
-0
src/libcore/cmp.rs
src/libcore/cmp.rs
+0
-4
src/libcore/default.rs
src/libcore/default.rs
+6
-0
src/libcore/hash/mod.rs
src/libcore/hash/mod.rs
+1
-0
src/libcore/intrinsics.rs
src/libcore/intrinsics.rs
+2
-0
src/libcore/iter.rs
src/libcore/iter.rs
+5
-3
src/libcore/lib.rs
src/libcore/lib.rs
+1
-1
src/libcore/macros.rs
src/libcore/macros.rs
+2
-0
src/libcore/marker.rs
src/libcore/marker.rs
+7
-0
src/libcore/mem.rs
src/libcore/mem.rs
+4
-0
src/libcore/ops.rs
src/libcore/ops.rs
+10
-0
src/libcore/option.rs
src/libcore/option.rs
+1
-0
src/libcore/result.rs
src/libcore/result.rs
+6
-0
src/libcore/str/mod.rs
src/libcore/str/mod.rs
+0
-2
未找到文件。
src/libcore/cell.rs
浏览文件 @
82784cb8
...
...
@@ -76,6 +76,7 @@
//! a trait method that was originally defined to take `&self`.
//!
//! ```
//! # #![allow(dead_code)]
//! use std::cell::RefCell;
//!
//! struct Graph {
...
...
@@ -125,6 +126,7 @@
//! }
//!
//! struct RcBox<T> {
//! # #[allow(dead_code)]
//! value: T,
//! refcount: Cell<usize>
//! }
...
...
@@ -776,6 +778,7 @@ fn deref_mut(&mut self) -> &mut T {
/// use std::cell::UnsafeCell;
/// use std::marker::Sync;
///
/// # #[allow(dead_code)]
/// struct NotThreadSafe<T> {
/// value: UnsafeCell<T>,
/// }
...
...
src/libcore/cmp.rs
浏览文件 @
82784cb8
...
...
@@ -140,8 +140,6 @@ unsafe fn from_i8_unchecked(v: i8) -> Ordering {
/// This method can be used to reverse a comparison:
///
/// ```
/// use std::cmp::Ordering;
///
/// let mut data: &mut [_] = &mut [2, 10, 5, 8];
///
/// // sort the array from largest to smallest.
...
...
@@ -263,8 +261,6 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
/// # Examples
///
/// ```
/// use std::cmp::Ordering;
///
/// let result = 1.0 < 2.0;
/// assert_eq!(result, true);
///
...
...
src/libcore/default.rs
浏览文件 @
82784cb8
...
...
@@ -15,6 +15,7 @@
//! that define a set of options:
//!
//! ```
//! # #[allow(dead_code)]
//! struct SomeOptions {
//! foo: i32,
//! bar: f32,
...
...
@@ -24,6 +25,7 @@
//! How can we define some default values? You can use `Default`:
//!
//! ```
//! # #[allow(dead_code)]
//! #[derive(Default)]
//! struct SomeOptions {
//! foo: i32,
...
...
@@ -40,6 +42,7 @@
//! If you have your own type, you need to implement `Default` yourself:
//!
//! ```
//! # #![allow(dead_code)]
//! enum Kind {
//! A,
//! B,
...
...
@@ -66,6 +69,7 @@
//! If you want to override a particular option, but still retain the other defaults:
//!
//! ```
//! # #[allow(dead_code)]
//! # #[derive(Default)]
//! # struct SomeOptions {
//! # foo: i32,
...
...
@@ -88,6 +92,7 @@
/// # Examples
///
/// ```
/// # #[allow(dead_code)]
/// #[derive(Default)]
/// struct SomeOptions {
/// foo: i32,
...
...
@@ -114,6 +119,7 @@ pub trait Default: Sized {
/// Making your own:
///
/// ```
/// # #[allow(dead_code)]
/// enum Kind {
/// A,
/// B,
...
...
src/libcore/hash/mod.rs
浏览文件 @
82784cb8
...
...
@@ -45,6 +45,7 @@
//!
//! struct Person {
//! id: u32,
//! # #[allow(dead_code)]
//! name: String,
//! phone: u64,
//! }
...
...
src/libcore/intrinsics.rs
浏览文件 @
82784cb8
...
...
@@ -334,6 +334,7 @@
/// use std::mem;
/// use std::ptr;
///
/// # #[allow(dead_code)]
/// fn swap<T>(x: &mut T, y: &mut T) {
/// unsafe {
/// // Give ourselves some scratch space to work with
...
...
@@ -372,6 +373,7 @@
/// ```
/// use std::ptr;
///
/// # #[allow(dead_code)]
/// unsafe fn from_buf_raw<T>(ptr: *const T, elts: usize) -> Vec<T> {
/// let mut dst = Vec::with_capacity(elts);
/// dst.set_len(elts);
...
...
src/libcore/iter.rs
浏览文件 @
82784cb8
...
...
@@ -241,6 +241,7 @@
//! method calls a closure on each element it iterates over:
//!
//! ```
//! # #![allow(unused_must_use)]
//! let v = vec![1, 2, 3, 4, 5];
//! v.iter().map(|x| println!("{}", x));
//! ```
...
...
@@ -419,7 +420,7 @@ pub trait Iterator {
///
/// ```
/// // an infinite iterator has no upper bound
/// let iter =
(0..)
;
/// let iter =
0..
;
///
/// assert_eq!((0, None), iter.size_hint());
/// ```
...
...
@@ -709,6 +710,7 @@ fn zip<U>(self, other: U) -> Zip<Self, U::IntoIter> where
/// If you're doing some sort of side effect, prefer [`for`] to `map()`:
///
/// ```
/// # #![allow(unused_must_use)]
/// // don't do this:
/// (0..5).map(|x| println!("{}", x));
///
...
...
@@ -2695,7 +2697,7 @@ fn next_back(&mut self) -> Option<I::Item> { (**self).next_back() }
///
/// ```
/// // a finite range knows exactly how many times it will iterate
/// let five =
(0..5)
;
/// let five =
0..5
;
///
/// assert_eq!(5, five.len());
/// ```
...
...
@@ -2761,7 +2763,7 @@ pub trait ExactSizeIterator: Iterator {
///
/// ```
/// // a finite range knows exactly how many times it will iterate
/// let five =
(0..5)
;
/// let five =
0..5
;
///
/// assert_eq!(5, five.len());
/// ```
...
...
src/libcore/lib.rs
浏览文件 @
82784cb8
...
...
@@ -60,7 +60,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/"
)]
#![doc(test(no_crate_inject))]
#![doc(test(no_crate_inject
,
attr(allow(unused_variables),
deny(warnings))
))]
#![no_core]
#![allow(raw_pointer_derive)]
...
...
src/libcore/macros.rs
浏览文件 @
82784cb8
...
...
@@ -247,6 +247,7 @@
/// Match arms:
///
/// ```
/// # #[allow(dead_code)]
/// fn foo(x: Option<i32>) {
/// match x {
/// Some(n) if n >= 0 => println!("Some(Non-negative)"),
...
...
@@ -260,6 +261,7 @@
/// Iterators:
///
/// ```
/// # #[allow(dead_code)]
/// fn divide_by_three(x: u32) -> u32 { // one of the poorest implementations of x/3
/// for i in 0.. {
/// if 3*i < i { panic!("u32 overflow"); }
...
...
src/libcore/marker.rs
浏览文件 @
82784cb8
...
...
@@ -42,6 +42,7 @@ impl<T> !Send for *mut T { }
/// `?Sized` can be used to remove this bound if it is not appropriate.
///
/// ```
/// # #![allow(dead_code)]
/// struct Foo<T>(T);
/// struct Bar<T: ?Sized>(T);
///
...
...
@@ -106,6 +107,7 @@ pub trait Unsize<T: ?Sized> {
/// `struct` can be `Copy`:
///
/// ```
/// # #[allow(dead_code)]
/// struct Point {
/// x: i32,
/// y: i32,
...
...
@@ -115,6 +117,7 @@ pub trait Unsize<T: ?Sized> {
/// A `struct` can be `Copy`, and `i32` is `Copy`, so therefore, `Point` is eligible to be `Copy`.
///
/// ```
/// # #![allow(dead_code)]
/// # struct Point;
/// struct PointList {
/// points: Vec<Point>,
...
...
@@ -303,6 +306,7 @@ fn default() -> $t<T> {
/// ```
/// use std::marker::PhantomData;
///
/// # #[allow(dead_code)]
/// struct Slice<'a, T:'a> {
/// start: *const T,
/// end: *const T,
...
...
@@ -323,6 +327,7 @@ fn default() -> $t<T> {
/// mismatches by enforcing types in the method implementations:
///
/// ```
/// # #![allow(dead_code)]
/// # trait ResType { fn foo(&self); }
/// # struct ParamType;
/// # mod foreign_lib {
...
...
@@ -393,6 +398,8 @@ unsafe impl<'a, T: Send + ?Sized> Send for &'a mut T {}
/// #![feature(reflect_marker)]
/// use std::marker::Reflect;
/// use std::any::Any;
///
/// # #[allow(dead_code)]
/// fn foo<T:Reflect+'static>(x: &T) {
/// let any: &Any = x;
/// if any.is::<u32>() { println!("u32"); }
...
...
src/libcore/mem.rs
浏览文件 @
82784cb8
...
...
@@ -92,6 +92,7 @@
/// use std::mem;
/// use std::ptr;
///
/// # #[allow(dead_code)]
/// fn swap<T>(x: &mut T, y: &mut T) {
/// unsafe {
/// // Give ourselves some scratch space to work with
...
...
@@ -151,6 +152,7 @@ pub fn size_of_val<T: ?Sized>(val: &T) -> usize {
/// # Examples
///
/// ```
/// # #![allow(deprecated)]
/// use std::mem;
///
/// assert_eq!(4, mem::min_align_of::<i32>());
...
...
@@ -167,6 +169,7 @@ pub fn min_align_of<T>() -> usize {
/// # Examples
///
/// ```
/// # #![allow(deprecated)]
/// use std::mem;
///
/// assert_eq!(4, mem::min_align_of_val(&5i32));
...
...
@@ -414,6 +417,7 @@ pub fn swap<T>(x: &mut T, y: &mut T) {
/// `self`, allowing it to be returned:
///
/// ```
/// # #![allow(dead_code)]
/// use std::mem;
/// # struct Buffer<T> { buf: Vec<T> }
/// impl<T> Buffer<T> {
...
...
src/libcore/ops.rs
浏览文件 @
82784cb8
...
...
@@ -947,6 +947,7 @@ fn shr(self, other: $f) -> $t {
/// }
/// }
///
/// # #[allow(unused_assignments)]
/// fn main() {
/// let mut foo = Foo;
/// foo += Foo;
...
...
@@ -996,6 +997,7 @@ fn add_assign(&mut self, other: $t) { *self += other }
/// }
/// }
///
/// # #[allow(unused_assignments)]
/// fn main() {
/// let mut foo = Foo;
/// foo -= Foo;
...
...
@@ -1045,6 +1047,7 @@ fn sub_assign(&mut self, other: $t) { *self -= other }
/// }
/// }
///
/// # #[allow(unused_assignments)]
/// fn main() {
/// let mut foo = Foo;
/// foo *= Foo;
...
...
@@ -1094,6 +1097,7 @@ fn mul_assign(&mut self, other: $t) { *self *= other }
/// }
/// }
///
/// # #[allow(unused_assignments)]
/// fn main() {
/// let mut foo = Foo;
/// foo /= Foo;
...
...
@@ -1143,6 +1147,7 @@ fn div_assign(&mut self, other: $t) { *self /= other }
/// }
/// }
///
/// # #[allow(unused_assignments)]
/// fn main() {
/// let mut foo = Foo;
/// foo %= Foo;
...
...
@@ -1192,6 +1197,7 @@ fn rem_assign(&mut self, other: $t) { *self %= other }
/// }
/// }
///
/// # #[allow(unused_assignments)]
/// fn main() {
/// let mut foo = Foo;
/// foo &= Foo;
...
...
@@ -1241,6 +1247,7 @@ fn bitand_assign(&mut self, other: $t) { *self &= other }
/// }
/// }
///
/// # #[allow(unused_assignments)]
/// fn main() {
/// let mut foo = Foo;
/// foo |= Foo;
...
...
@@ -1290,6 +1297,7 @@ fn bitor_assign(&mut self, other: $t) { *self |= other }
/// }
/// }
///
/// # #[allow(unused_assignments)]
/// fn main() {
/// let mut foo = Foo;
/// foo ^= Foo;
...
...
@@ -1339,6 +1347,7 @@ fn bitxor_assign(&mut self, other: $t) { *self ^= other }
/// }
/// }
///
/// # #[allow(unused_assignments)]
/// fn main() {
/// let mut foo = Foo;
/// foo <<= Foo;
...
...
@@ -1407,6 +1416,7 @@ fn shl_assign(&mut self, other: $f) {
/// }
/// }
///
/// # #[allow(unused_assignments)]
/// fn main() {
/// let mut foo = Foo;
/// foo >>= Foo;
...
...
src/libcore/option.rs
浏览文件 @
82784cb8
...
...
@@ -275,6 +275,7 @@ pub fn as_mut(&mut self) -> Option<&mut T> {
///
/// ```
/// #![feature(as_slice)]
/// # #![allow(deprecated)]
///
/// let mut x = Some("Diamonds");
/// {
...
...
src/libcore/result.rs
浏览文件 @
82784cb8
...
...
@@ -16,6 +16,7 @@
//! and containing an error value.
//!
//! ```
//! # #[allow(dead_code)]
//! enum Result<T, E> {
//! Ok(T),
//! Err(E)
...
...
@@ -104,6 +105,7 @@
//! something like this:
//!
//! ```no_run
//! # #![allow(unused_must_use)] // \o/
//! use std::fs::File;
//! use std::io::prelude::*;
//!
...
...
@@ -143,6 +145,7 @@
//! # use std::fs::File;
//! # use std::io::prelude::*;
//! # use std::io;
//! # #[allow(dead_code)]
//! fn write_message() -> io::Result<()> {
//! let mut file = try!(File::create("valuable_data.txt"));
//! try!(file.write_all(b"important message"));
...
...
@@ -160,6 +163,7 @@
//! It replaces this:
//!
//! ```
//! # #![allow(dead_code)]
//! use std::fs::File;
//! use std::io::prelude::*;
//! use std::io;
...
...
@@ -189,6 +193,7 @@
//! With this:
//!
//! ```
//! # #![allow(dead_code)]
//! use std::fs::File;
//! use std::io::prelude::*;
//! use std::io;
...
...
@@ -422,6 +427,7 @@ pub fn as_slice(&self) -> &[T] {
///
/// ```
/// #![feature(as_slice)]
/// # #![allow(deprecated)]
///
/// let mut x: Result<&str, u32> = Ok("Gold");
/// {
...
...
src/libcore/str/mod.rs
浏览文件 @
82784cb8
...
...
@@ -142,8 +142,6 @@ impl Utf8Error {
/// Basic usage:
///
/// ```
/// #![feature(utf8_error)]
///
/// use std::str;
///
/// // some invalid bytes, in a vector
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录