]> git.lizzy.rs Git - rust.git/commitdiff
libserialize: deny warnings in doctests
authorKevin Butler <haqkrs@gmail.com>
Tue, 3 Nov 2015 16:17:57 +0000 (16:17 +0000)
committerKevin Butler <haqkrs@gmail.com>
Thu, 12 Nov 2015 05:16:53 +0000 (05:16 +0000)
mk/tests.mk
src/libserialize/json.rs
src/libserialize/lib.rs

index 744f17531d6124d8d722198f3cc9a9a4fc232027..ed6e2b003445b4e8b393070e396cb45e8e83b580 100644 (file)
@@ -26,7 +26,7 @@ TEST_TARGET_CRATES = $(filter-out core rustc_unicode alloc_system libc \
                                  alloc_jemalloc,$(TARGET_CRATES)) \
                        collectionstest coretest
 TEST_DOC_CRATES = $(DOC_CRATES) arena flate fmt_macros getopts graphviz \
-                log rand rbml
+                log rand rbml serialize
 TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_resolve \
                                rustc_trans rustc_lint,\
                      $(HOST_CRATES))
index 452feed3cdb4effa751e10616edabbd5867e9e98..9e1e3c6a558055436dc2fa38cc25b8bc3c8cf84c 100644 (file)
@@ -77,8 +77,9 @@
 //! serialization API, using the derived serialization code.
 //!
 //! ```rust
-//! extern crate serialize;
-//! use serialize::json;
+//! # #![feature(rustc_private)]
+//! extern crate serialize as rustc_serialize; // for the deriving below
+//! use rustc_serialize::json;
 //!
 //! // Automatically generate `Decodable` and `Encodable` trait implementations
 //! #[derive(RustcDecodable, RustcEncodable)]
 //! ### Simple example of `ToJson` usage
 //!
 //! ```rust
+//! # #![feature(rustc_private)]
 //! extern crate serialize;
 //! use serialize::json::{self, ToJson, Json};
 //!
 //! ### Verbose example of `ToJson` usage
 //!
 //! ```rust
+//! # #![feature(rustc_private)]
 //! extern crate serialize;
 //! use std::collections::BTreeMap;
 //! use serialize::json::{self, Json, ToJson};
 //!     let json_str: String = json_obj.to_string();
 //!
 //!     // Deserialize like before
-//!     let decoded: TestStruct = json::decode(json_str)).unwrap();
+//!     let decoded: TestStruct = json::decode(&json_str).unwrap();
 //! }
 //! ```
 
index 5b7bec41723cde69df2dc823c2030899dae9ee8a..4a766f14531374865b8aa505f9b772ace3bebcec 100644 (file)
@@ -26,7 +26,8 @@
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
        html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
        html_root_url = "https://doc.rust-lang.org/nightly/",
-       html_playground_url = "https://play.rust-lang.org/")]
+       html_playground_url = "https://play.rust-lang.org/",
+       test(attr(allow(unused_variables), deny(warnings))))]
 
 #![feature(box_syntax)]
 #![feature(collections)]