From 50c615baa2c09694f0ba446c53777e98db88ed01 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 15 Apr 2019 16:34:08 +0200 Subject: [PATCH] warn(missing_docs) in liballoc, and add missing docs --- src/liballoc/borrow.rs | 1 + src/liballoc/boxed.rs | 1 + src/liballoc/lib.rs | 1 + src/liballoc/slice.rs | 10 ++++++++++ 4 files changed, 13 insertions(+) diff --git a/src/liballoc/borrow.rs b/src/liballoc/borrow.rs index ee1799fad8e..d5e15b3719c 100644 --- a/src/liballoc/borrow.rs +++ b/src/liballoc/borrow.rs @@ -32,6 +32,7 @@ fn borrow(&self) -> &B { /// from any borrow of a given type. #[stable(feature = "rust1", since = "1.0.0")] pub trait ToOwned { + /// The resulting type after obtaining ownership. #[stable(feature = "rust1", since = "1.0.0")] type Owned: Borrow; diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 6a6a9146e24..8a3950718d7 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -760,6 +760,7 @@ extern "rust-call" fn call(&self, args: A) -> Self::Output { #[unstable(feature = "fnbox", reason = "will be deprecated if and when `Box` becomes usable", issue = "28796")] pub trait FnBox: FnOnce { + /// Performs the call operation. fn call_box(self: Box, args: A) -> Self::Output; } diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index d8d61c673af..63b3fbbdaef 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -59,6 +59,7 @@ #![needs_allocator] #![warn(deprecated_in_future)] +#![warn(missing_docs)] #![warn(missing_debug_implementations)] #![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs index f4b2d463778..6eac8487401 100644 --- a/src/liballoc/slice.rs +++ b/src/liballoc/slice.rs @@ -570,6 +570,16 @@ pub trait SliceConcatExt { #[stable(feature = "rename_connect_to_join", since = "1.3.0")] fn join(&self, sep: &T) -> Self::Output; + /// Flattens a slice of `T` into a single value `Self::Output`, placing a + /// given separator between each. + /// + /// # Examples + /// + /// ``` + /// # #![allow(deprecated)] + /// assert_eq!(["hello", "world"].connect(" "), "hello world"); + /// assert_eq!([[1, 2], [3, 4]].connect(&0), [1, 2, 0, 3, 4]); + /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[rustc_deprecated(since = "1.3.0", reason = "renamed to join")] fn connect(&self, sep: &T) -> Self::Output; -- 2.44.0