about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-05-08 04:50:28 +0000
committerbors <bors@rust-lang.org>2023-05-08 04:50:28 +0000
commitea0c22ea4f58f181d6739fbe624329e576ce7994 (patch)
tree5e3dea659dd2ed390720bb92f62ef287b1c8e41f /library/std/src
parent04c53444dff325a0a3a4cb88cb952fbf341861ec (diff)
parent4e7c14fe9f03dd0189f954bd9cb97c3c513e7eed (diff)
downloadrust-ea0c22ea4f58f181d6739fbe624329e576ce7994.tar.gz
rust-ea0c22ea4f58f181d6739fbe624329e576ce7994.zip
Auto merge of #106621 - ozkanonur:enable-elided-lifetimes-for-doctests, r=Mark-Simulacrum
enable `rust_2018_idioms` lint group for doctests

With this change, `rust_2018_idioms` lint group will be enabled for compiler/libstd doctests.

Resolves #106086
Resolves #99144

Signed-off-by: ozkanonur <work@onurozkan.dev>
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/keyword_docs.rs2
-rw-r--r--library/std/src/os/unix/fs.rs2
-rw-r--r--library/std/src/path.rs2
-rw-r--r--library/std/src/primitive_docs.rs1
-rw-r--r--library/std/src/process.rs2
5 files changed, 5 insertions, 4 deletions
diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs
index be6dc7768af..eb46f4e54bb 100644
--- a/library/std/src/keyword_docs.rs
+++ b/library/std/src/keyword_docs.rs
@@ -2287,7 +2287,7 @@ mod use_keyword {}
 /// # #![allow(dead_code)]
 /// pub enum Cow<'a, B>
 /// where
-///     B: 'a + ToOwned + ?Sized,
+///     B: ToOwned + ?Sized,
 /// {
 ///     Borrowed(&'a B),
 ///     Owned(<B as ToOwned>::Owned),
diff --git a/library/std/src/os/unix/fs.rs b/library/std/src/os/unix/fs.rs
index a0e664acd13..1e1c3693105 100644
--- a/library/std/src/os/unix/fs.rs
+++ b/library/std/src/os/unix/fs.rs
@@ -368,7 +368,7 @@ pub trait OpenOptionsExt {
     ///
     /// ```no_run
     /// # #![feature(rustc_private)]
-    /// extern crate libc;
+    /// use libc;
     /// use std::fs::OpenOptions;
     /// use std::os::unix::fs::OpenOptionsExt;
     ///
diff --git a/library/std/src/path.rs b/library/std/src/path.rs
index 198996c5f70..43203c5824d 100644
--- a/library/std/src/path.rs
+++ b/library/std/src/path.rs
@@ -117,7 +117,7 @@ use crate::sys::path::{is_sep_byte, is_verbatim_sep, parse_prefix, MAIN_SEP_STR}
 /// use std::path::Prefix::*;
 /// use std::ffi::OsStr;
 ///
-/// fn get_path_prefix(s: &str) -> Prefix {
+/// fn get_path_prefix(s: &str) -> Prefix<'_> {
 ///     let path = Path::new(s);
 ///     match path.components().next().unwrap() {
 ///         Component::Prefix(prefix_component) => prefix_component.kind(),
diff --git a/library/std/src/primitive_docs.rs b/library/std/src/primitive_docs.rs
index e06ccb5b287..8266e899011 100644
--- a/library/std/src/primitive_docs.rs
+++ b/library/std/src/primitive_docs.rs
@@ -550,6 +550,7 @@ impl Copy for () {
 ///
 /// ```
 /// # #![feature(rustc_private)]
+/// #[allow(unused_extern_crates)]
 /// extern crate libc;
 ///
 /// use std::mem;
diff --git a/library/std/src/process.rs b/library/std/src/process.rs
index bf22c2d46c9..9da74a5ddb5 100644
--- a/library/std/src/process.rs
+++ b/library/std/src/process.rs
@@ -1842,7 +1842,7 @@ impl ExitCode {
     /// # use std::fmt;
     /// # enum UhOhError { GenericProblem, Specific, WithCode { exit_code: ExitCode, _x: () } }
     /// # impl fmt::Display for UhOhError {
-    /// #     fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result { unimplemented!() }
+    /// #     fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result { unimplemented!() }
     /// # }
     /// // there's no way to gracefully recover from an UhOhError, so we just
     /// // print a message and exit