Skip to content

Commit 569f29c

Browse files
committed
libserialize: deny warnings in doctests
1 parent 640aab3 commit 569f29c

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

mk/tests.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ TEST_TARGET_CRATES = $(filter-out core rustc_unicode alloc_system \
2626
alloc_jemalloc,$(TARGET_CRATES)) \
2727
collectionstest coretest
2828
TEST_DOC_CRATES = $(DOC_CRATES) arena flate fmt_macros getopts graphviz \
29-
log rand rbml
29+
log rand rbml serialize
3030
TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_resolve \
3131
rustc_trans rustc_lint,\
3232
$(HOST_CRATES))

src/libserialize/json.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@
7777
//! serialization API, using the derived serialization code.
7878
//!
7979
//! ```rust
80-
//! extern crate serialize;
81-
//! use serialize::json;
80+
//! # #![feature(rustc_private)]
81+
//! extern crate serialize as rustc_serialize; // for the deriving below
82+
//! use rustc_serialize::json;
8283
//!
8384
//! // Automatically generate `Decodable` and `Encodable` trait implementations
8485
//! #[derive(RustcDecodable, RustcEncodable)]
@@ -111,6 +112,7 @@
111112
//! ### Simple example of `ToJson` usage
112113
//!
113114
//! ```rust
115+
//! # #![feature(rustc_private)]
114116
//! extern crate serialize;
115117
//! use serialize::json::{self, ToJson, Json};
116118
//!
@@ -150,6 +152,7 @@
150152
//! ### Verbose example of `ToJson` usage
151153
//!
152154
//! ```rust
155+
//! # #![feature(rustc_private)]
153156
//! extern crate serialize;
154157
//! use std::collections::BTreeMap;
155158
//! use serialize::json::{self, Json, ToJson};
@@ -185,7 +188,7 @@
185188
//! let json_str: String = json_obj.to_string();
186189
//!
187190
//! // Deserialize like before
188-
//! let decoded: TestStruct = json::decode(json_str)).unwrap();
191+
//! let decoded: TestStruct = json::decode(&json_str).unwrap();
189192
//! }
190193
//! ```
191194

src/libserialize/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ Core encoding and decoding interfaces.
2626
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
2727
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
2828
html_root_url = "https://doc.rust-lang.org/nightly/",
29-
html_playground_url = "https://play.rust-lang.org/")]
29+
html_playground_url = "https://play.rust-lang.org/",
30+
test(attr(allow(unused_variables), deny(warnings))))]
3031

3132
#![feature(box_syntax)]
3233
#![feature(collections)]

0 commit comments

Comments
 (0)