From 5d32786b4f656f7b7e44a8afbf124e924dc12429 Mon Sep 17 00:00:00 2001 From: Camelid Date: Sat, 22 Aug 2020 15:44:00 -0700 Subject: [PATCH 01/16] Switch to intra-doc links in `std::macros` Also: * Fix typo in module docs * Link to `std::io::stderr` instead of `std::io::Stderr` to match the link text * Link to `std::io::stdout` --- library/std/src/macros.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/library/std/src/macros.rs b/library/std/src/macros.rs index 724dbada9305c..3ffce6f7223b8 100644 --- a/library/std/src/macros.rs +++ b/library/std/src/macros.rs @@ -1,6 +1,6 @@ //! Standard library macros //! -//! This modules contains a set of macros which are exported from the standard +//! This module contains a set of macros which are exported from the standard //! library. Each macro is available for use when linking against the standard //! library. @@ -29,9 +29,7 @@ macro_rules! panic { /// Use `print!` only for the primary output of your program. Use /// [`eprint!`] instead to print error and progress messages. /// -/// [`println!`]: ../std/macro.println.html -/// [flush]: ../std/io/trait.Write.html#tymethod.flush -/// [`eprint!`]: ../std/macro.eprint.html +/// [flush]: crate::io::Write::flush /// /// # Panics /// @@ -74,13 +72,12 @@ macro_rules! print { /// Use `println!` only for the primary output of your program. Use /// [`eprintln!`] instead to print error and progress messages. /// -/// [`format!`]: ../std/macro.format.html -/// [`std::fmt`]: ../std/fmt/index.html -/// [`eprintln!`]: ../std/macro.eprintln.html /// # Panics /// /// Panics if writing to `io::stdout` fails. /// +/// [`io::stdout`]: crate::io::stdout +/// /// # Examples /// /// ``` @@ -107,8 +104,8 @@ macro_rules! println { /// Use `eprint!` only for error and progress messages. Use `print!` /// instead for the primary output of your program. /// -/// [`io::stderr`]: ../std/io/struct.Stderr.html -/// [`print!`]: ../std/macro.print.html +/// [`io::stderr`]: crate::io::stderr +/// [`io::stdout`]: crate::io::stdout /// /// # Panics /// @@ -135,8 +132,8 @@ macro_rules! eprint { /// Use `eprintln!` only for error and progress messages. Use `println!` /// instead for the primary output of your program. /// -/// [`io::stderr`]: ../std/io/struct.Stderr.html -/// [`println!`]: ../std/macro.println.html +/// [`io::stderr`]: crate::io::stderr +/// [`io::stdout`]: crate::io::stdout /// /// # Panics /// From becf5ec4ea65d1805a3a9fe5a55e2db8a86b9e47 Mon Sep 17 00:00:00 2001 From: Camelid Date: Sat, 22 Aug 2020 17:41:40 -0700 Subject: [PATCH 02/16] Add missing intra-doc link --- library/std/src/macros.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/std/src/macros.rs b/library/std/src/macros.rs index 3ffce6f7223b8..d7be1bdb4f9f3 100644 --- a/library/std/src/macros.rs +++ b/library/std/src/macros.rs @@ -72,6 +72,8 @@ macro_rules! print { /// Use `println!` only for the primary output of your program. Use /// [`eprintln!`] instead to print error and progress messages. /// +/// [`std::fmt`]: crate::fmt +/// /// # Panics /// /// Panics if writing to `io::stdout` fails. From 637659be6a87da5c8972f147d7a508bb808d669b Mon Sep 17 00:00:00 2001 From: Camelid Date: Sat, 22 Aug 2020 20:23:50 -0700 Subject: [PATCH 03/16] Add missing links --- library/std/src/macros.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/std/src/macros.rs b/library/std/src/macros.rs index d7be1bdb4f9f3..e8898d98ff35f 100644 --- a/library/std/src/macros.rs +++ b/library/std/src/macros.rs @@ -76,7 +76,7 @@ macro_rules! print { /// /// # Panics /// -/// Panics if writing to `io::stdout` fails. +/// Panics if writing to [`io::stdout`] fails. /// /// [`io::stdout`]: crate::io::stdout /// @@ -100,7 +100,7 @@ macro_rules! println { /// Prints to the standard error. /// /// Equivalent to the [`print!`] macro, except that output goes to -/// [`io::stderr`] instead of `io::stdout`. See [`print!`] for +/// [`io::stderr`] instead of [`io::stdout`]. See [`print!`] for /// example usage. /// /// Use `eprint!` only for error and progress messages. Use `print!` @@ -128,7 +128,7 @@ macro_rules! eprint { /// Prints to the standard error, with a newline. /// /// Equivalent to the [`println!`] macro, except that output goes to -/// [`io::stderr`] instead of `io::stdout`. See [`println!`] for +/// [`io::stderr`] instead of [`io::stdout`]. See [`println!`] for /// example usage. /// /// Use `eprintln!` only for error and progress messages. Use `println!` From 69d3334adf9d7042546aba741bca7fc7b0ffd2bc Mon Sep 17 00:00:00 2001 From: JR Heard Date: Sat, 22 Aug 2020 22:21:03 -0700 Subject: [PATCH 04/16] Fix typo in documentation of i32 wrapping_abs() --- library/core/src/num/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/num/mod.rs b/library/core/src/num/mod.rs index 6893717627035..7a88cfbb74dd4 100644 --- a/library/core/src/num/mod.rs +++ b/library/core/src/num/mod.rs @@ -1573,7 +1573,7 @@ $EndFeature, " the boundary of the type. The only case where such wrapping can occur is when one takes the absolute value of the negative -minimal value for the type this is a positive value that is too large to represent in the type. In +minimal value for the type; this is a positive value that is too large to represent in the type. In such a case, this function returns `MIN` itself. # Examples From 2c995d29f72c0d295ecddd6315520f8abf1ab8f8 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sun, 23 Aug 2020 10:02:42 +0000 Subject: [PATCH 05/16] Prefer https link for wikipedia URLs --- library/alloc/src/collections/binary_heap.rs | 6 +++--- library/core/src/cmp.rs | 2 +- library/std/src/sync/barrier.rs | 2 +- library/test/src/stats.rs | 6 +++--- src/librustc_expand/mbe.rs | 2 +- src/librustc_middle/ty/sty.rs | 2 +- src/librustc_symbol_mangling/legacy.rs | 2 +- .../unboxed-closures/unboxed-closures-infer-recursive-fn.rs | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/library/alloc/src/collections/binary_heap.rs b/library/alloc/src/collections/binary_heap.rs index 8398cfa3bd34e..477a598ff5b00 100644 --- a/library/alloc/src/collections/binary_heap.rs +++ b/library/alloc/src/collections/binary_heap.rs @@ -12,9 +12,9 @@ //! to solve the [shortest path problem][sssp] on a [directed graph][dir_graph]. //! It shows how to use [`BinaryHeap`] with custom types. //! -//! [dijkstra]: http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm -//! [sssp]: http://en.wikipedia.org/wiki/Shortest_path_problem -//! [dir_graph]: http://en.wikipedia.org/wiki/Directed_graph +//! [dijkstra]: https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm +//! [sssp]: https://en.wikipedia.org/wiki/Shortest_path_problem +//! [dir_graph]: https://en.wikipedia.org/wiki/Directed_graph //! [`BinaryHeap`]: struct.BinaryHeap.html //! //! ``` diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index e775ded60f593..b9ad50f770347 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -25,7 +25,7 @@ use self::Ordering::*; /// Trait for equality comparisons which are [partial equivalence -/// relations](http://en.wikipedia.org/wiki/Partial_equivalence_relation). +/// relations](https://en.wikipedia.org/wiki/Partial_equivalence_relation). /// /// This trait allows for partial equality, for types that do not have a full /// equivalence relation. For example, in floating point numbers `NaN != NaN`, diff --git a/library/std/src/sync/barrier.rs b/library/std/src/sync/barrier.rs index 01314370ce399..23c989fd2fdfb 100644 --- a/library/std/src/sync/barrier.rs +++ b/library/std/src/sync/barrier.rs @@ -131,7 +131,7 @@ impl Barrier { lock.count += 1; if lock.count < self.num_threads { // We need a while loop to guard against spurious wakeups. - // http://en.wikipedia.org/wiki/Spurious_wakeup + // https://en.wikipedia.org/wiki/Spurious_wakeup while local_gen == lock.generation_id && lock.count < self.num_threads { lock = self.cvar.wait(lock).unwrap(); } diff --git a/library/test/src/stats.rs b/library/test/src/stats.rs index 077005371c0cf..c02f93bf9d42f 100644 --- a/library/test/src/stats.rs +++ b/library/test/src/stats.rs @@ -84,7 +84,7 @@ pub trait Stats { /// by the constant `1.4826` to allow its use as a consistent estimator for the standard /// deviation. /// - /// See: + /// See: fn median_abs_dev(&self) -> f64; /// Median absolute deviation as a percent of the median. See `median_abs_dev` and `median`. @@ -96,7 +96,7 @@ pub trait Stats { /// /// Calculated by linear interpolation between closest ranks. /// - /// See: + /// See: fn percentile(&self, pct: f64) -> f64; /// Quartiles of the sample: three values that divide the sample into four equal groups, each @@ -302,7 +302,7 @@ fn percentile_of_sorted(sorted_samples: &[f64], pct: f64) -> f64 { /// It differs from trimming in that it does not change the number of samples, /// just changes the values of those that are outliers. /// -/// See: +/// See: pub fn winsorize(samples: &mut [f64], pct: f64) { let mut tmp = samples.to_vec(); local_sort(&mut tmp); diff --git a/src/librustc_expand/mbe.rs b/src/librustc_expand/mbe.rs index e9e6fc5af2230..9aed307ec93ae 100644 --- a/src/librustc_expand/mbe.rs +++ b/src/librustc_expand/mbe.rs @@ -61,7 +61,7 @@ impl KleeneToken { } } -/// A Kleene-style [repetition operator](http://en.wikipedia.org/wiki/Kleene_star) +/// A Kleene-style [repetition operator](https://en.wikipedia.org/wiki/Kleene_star) /// for token sequences. #[derive(Clone, PartialEq, Encodable, Decodable, Debug, Copy)] enum KleeneOp { diff --git a/src/librustc_middle/ty/sty.rs b/src/librustc_middle/ty/sty.rs index 0a6e17a43d8db..c1f354c7a15f3 100644 --- a/src/librustc_middle/ty/sty.rs +++ b/src/librustc_middle/ty/sty.rs @@ -1264,7 +1264,7 @@ rustc_index::newtype_index! { /// De Bruijn index of 0, because the innermost binder in that location /// is the outer fn. /// - /// [dbi]: http://en.wikipedia.org/wiki/De_Bruijn_index + /// [dbi]: https://en.wikipedia.org/wiki/De_Bruijn_index #[derive(HashStable)] pub struct DebruijnIndex { DEBUG_FORMAT = "DebruijnIndex({})", diff --git a/src/librustc_symbol_mangling/legacy.rs b/src/librustc_symbol_mangling/legacy.rs index 2ae13b501e941..24356844bafc9 100644 --- a/src/librustc_symbol_mangling/legacy.rs +++ b/src/librustc_symbol_mangling/legacy.rs @@ -136,7 +136,7 @@ fn get_symbol_hash<'tcx>( } // Follow C++ namespace-mangling style, see -// http://en.wikipedia.org/wiki/Name_mangling for more info. +// https://en.wikipedia.org/wiki/Name_mangling for more info. // // It turns out that on macOS you can actually have arbitrary symbols in // function names (at least when given to LLVM), but this is not possible diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-recursive-fn.rs b/src/test/ui/unboxed-closures/unboxed-closures-infer-recursive-fn.rs index 86834f49407fc..a0fbbafe25ffb 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-recursive-fn.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-recursive-fn.rs @@ -7,7 +7,7 @@ use std::marker::PhantomData; // closure. As far as I can tell, coding up a recursive closure // requires the good ol' [Y Combinator]. // -// [Y Combinator]: http://en.wikipedia.org/wiki/Fixed-point_combinator#Y_combinator +// [Y Combinator]: https://en.wikipedia.org/wiki/Fixed-point_combinator#Y_combinator struct YCombinator { func: F, From 18f47d81dae6740a4b62262cf2518ea1cfe19e62 Mon Sep 17 00:00:00 2001 From: Ayush Kumar Mishra Date: Sun, 23 Aug 2020 10:55:15 +0530 Subject: [PATCH 06/16] Misleading documentation for derived Ord/PartialOrd implementation for enums #75620 --- library/core/src/cmp.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index e775ded60f593..ef691489f081c 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -505,7 +505,7 @@ impl Ord for Reverse { /// /// This trait can be used with `#[derive]`. When `derive`d on structs, it will produce a /// lexicographic ordering based on the top-to-bottom declaration order of the struct's members. -/// When `derive`d on enums, variants are ordered by their top-to-bottom declaration order. +/// When `derive`d on enums, variants are ordered by their top-to-bottom discriminant order. /// /// ## How can I implement `Ord`? /// @@ -694,7 +694,7 @@ impl PartialOrd for Ordering { /// /// This trait can be used with `#[derive]`. When `derive`d on structs, it will produce a /// lexicographic ordering based on the top-to-bottom declaration order of the struct's members. -/// When `derive`d on enums, variants are ordered by their top-to-bottom declaration order. +/// When `derive`d on enums, variants are ordered by their top-to-bottom discriminant order. /// /// ## How can I implement `PartialOrd`? /// From 2e6f2e885506ee46ea32622e33fe74d99774cf57 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sun, 23 Aug 2020 11:29:27 -0700 Subject: [PATCH 07/16] publish-toolstate: show more context on HTTP error --- src/tools/publish_toolstate.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/tools/publish_toolstate.py b/src/tools/publish_toolstate.py index 72b3df8377abb..51416c8ce6364 100755 --- a/src/tools/publish_toolstate.py +++ b/src/tools/publish_toolstate.py @@ -275,7 +275,7 @@ def update_latest( return message -if __name__ == '__main__': +def main(): repo = os.environ.get('TOOLSTATE_VALIDATE_MAINTAINERS_REPO') if repo: github_token = os.environ.get('TOOLSTATE_REPO_ACCESS_TOKEN') @@ -342,3 +342,11 @@ def update_latest( } )) response.read() + + +if __name__ == '__main__': + try: + main() + except urllib2.HTTPError as e: + print("HTTPError: %s\n%s" % (e, e.read())) + raise From e9928d8926e0de92d41ca3e8ac997517369a82bd Mon Sep 17 00:00:00 2001 From: Camelid <37223377+camelid@users.noreply.github.com> Date: Sun, 23 Aug 2020 13:51:01 -0700 Subject: [PATCH 08/16] Switch to intra-doc links in `std::collections` --- library/std/src/collections/mod.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/library/std/src/collections/mod.rs b/library/std/src/collections/mod.rs index b6488ae61b153..a1aab767eb26f 100644 --- a/library/std/src/collections/mod.rs +++ b/library/std/src/collections/mod.rs @@ -396,15 +396,7 @@ //! assert_eq!(map.keys().next().unwrap().b, "baz"); //! ``` //! -//! [`Vec`]: ../../std/vec/struct.Vec.html -//! [`HashMap`]: ../../std/collections/struct.HashMap.html -//! [`VecDeque`]: ../../std/collections/struct.VecDeque.html -//! [`LinkedList`]: ../../std/collections/struct.LinkedList.html -//! [`BTreeMap`]: ../../std/collections/struct.BTreeMap.html -//! [`HashSet`]: ../../std/collections/struct.HashSet.html -//! [`BTreeSet`]: ../../std/collections/struct.BTreeSet.html -//! [`BinaryHeap`]: ../../std/collections/struct.BinaryHeap.html -//! [`IntoIterator`]: ../../std/iter/trait.IntoIterator.html +//! [`IntoIterator`]: crate::iter::IntoIterator #![stable(feature = "rust1", since = "1.0.0")] From 04e8237c6d8a7ad8decfbe380467481d1f9c2a0b Mon Sep 17 00:00:00 2001 From: Camelid <37223377+camelid@users.noreply.github.com> Date: Sun, 23 Aug 2020 14:42:21 -0700 Subject: [PATCH 09/16] Switch to intra-doc links in `core::array` --- library/core/src/array/mod.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs index 6b28ab7d75563..88795d8429d29 100644 --- a/library/core/src/array/mod.rs +++ b/library/core/src/array/mod.rs @@ -32,9 +32,6 @@ pub use iter::IntoIter; /// Note that the traits [`AsRef`] and [`AsMut`] provide similar methods for types that /// may not be fixed-size arrays. Implementors should prefer those traits /// instead. -/// -/// [`AsRef`]: ../convert/trait.AsRef.html -/// [`AsMut`]: ../convert/trait.AsMut.html #[unstable(feature = "fixed_size_array", issue = "27778")] pub unsafe trait FixedSizeArray { /// Converts the array to immutable slice From 7c6362a19c9c80c25cbefd910427f3b99b0d6f2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sat, 22 Aug 2020 02:01:02 +0200 Subject: [PATCH 10/16] expand-yaml-anchors: fix clippy::match_ref_pats and clippy::redundant_closure --- src/tools/expand-yaml-anchors/src/main.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/tools/expand-yaml-anchors/src/main.rs b/src/tools/expand-yaml-anchors/src/main.rs index d8dad8fc789e9..f7ff64036a1a9 100644 --- a/src/tools/expand-yaml-anchors/src/main.rs +++ b/src/tools/expand-yaml-anchors/src/main.rs @@ -48,8 +48,8 @@ impl App { // Parse CLI arguments let args = std::env::args().skip(1).collect::>(); let (mode, base) = match args.iter().map(|s| s.as_str()).collect::>().as_slice() { - &["generate", ref base] => (Mode::Generate, PathBuf::from(base)), - &["check", ref base] => (Mode::Check, PathBuf::from(base)), + ["generate", ref base] => (Mode::Generate, PathBuf::from(base)), + ["check", ref base] => (Mode::Check, PathBuf::from(base)), _ => { eprintln!("usage: expand-yaml-anchors "); std::process::exit(1); @@ -138,9 +138,7 @@ fn filter_document(document: Yaml) -> Yaml { .map(|(key, value)| (filter_document(key), filter_document(value))) .collect(), ), - Yaml::Array(vec) => { - Yaml::Array(vec.into_iter().map(|item| filter_document(item)).collect()) - } + Yaml::Array(vec) => Yaml::Array(vec.into_iter().map(filter_document).collect()), other => other, } } From d97c4703eb427be4209bc2bd4845fa6abafa3eb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sat, 22 Aug 2020 02:09:20 +0200 Subject: [PATCH 11/16] linkcheckr: fix clippy::redundant_static_lifetimes and clippy::single_char_pattern --- src/tools/linkchecker/main.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs index 194318d7a59b5..b7ceba1e28262 100644 --- a/src/tools/linkchecker/main.rs +++ b/src/tools/linkchecker/main.rs @@ -172,10 +172,10 @@ fn check(cache: &mut Cache, root: &Path, file: &Path, errors: &mut bool) -> Opti { return; } - let mut parts = url.splitn(2, "#"); + let mut parts = url.splitn(2, '#'); let url = parts.next().unwrap(); let fragment = parts.next(); - let mut parts = url.splitn(2, "?"); + let mut parts = url.splitn(2, '?'); let url = parts.next().unwrap(); // Once we've plucked out the URL, parse it using our base url and @@ -258,7 +258,7 @@ fn check(cache: &mut Cache, root: &Path, file: &Path, errors: &mut bool) -> Opti } // These appear to be broken in mdbook right now? - if fragment.starts_with("-") { + if fragment.starts_with('-') { return; } @@ -324,7 +324,7 @@ fn load_file( } fn maybe_redirect(source: &str) -> Option { - const REDIRECT: &'static str = "

Redirecting to Redirecting to (contents: &str, attr: &str, }; let quote_delim = rest.as_bytes()[pos_quote] as char; - if rest[..pos_quote].trim_start_matches(" ") != "" { + if rest[..pos_quote].trim_start_matches(' ') != "" { continue; } let rest = &rest[pos_quote + 1..]; From d36e3e23a80f039ee98117ebba0bb2ea6e34f0c1 Mon Sep 17 00:00:00 2001 From: LeSeulArtichaut Date: Mon, 24 Aug 2020 00:13:23 +0200 Subject: [PATCH 12/16] Use intra-doc-links in `core::{char, macros, fmt}` --- library/core/src/char/mod.rs | 16 +++------ library/core/src/fmt/mod.rs | 64 ++++++++-------------------------- library/core/src/macros/mod.rs | 64 ++++++---------------------------- 3 files changed, 30 insertions(+), 114 deletions(-) diff --git a/library/core/src/char/mod.rs b/library/core/src/char/mod.rs index 1b4e906e4e475..7a68de5e6afb8 100644 --- a/library/core/src/char/mod.rs +++ b/library/core/src/char/mod.rs @@ -94,7 +94,6 @@ const MAX_THREE_B: u32 = 0x10000; /// Point], but only ones within a certain range. `MAX` is the highest valid /// code point that's a valid [Unicode Scalar Value]. /// -/// [`char`]: ../../std/primitive.char.html /// [Unicode Scalar Value]: http://www.unicode.org/glossary/#unicode_scalar_value /// [Code Point]: http://www.unicode.org/glossary/#code_point #[stable(feature = "rust1", since = "1.0.0")] @@ -114,8 +113,7 @@ pub const REPLACEMENT_CHARACTER: char = char::REPLACEMENT_CHARACTER; /// This `struct` is created by the [`escape_unicode`] method on [`char`]. See /// its documentation for more. /// -/// [`escape_unicode`]: ../../std/primitive.char.html#method.escape_unicode -/// [`char`]: ../../std/primitive.char.html +/// [`escape_unicode`]: char::escape_unicode #[derive(Clone, Debug)] #[stable(feature = "rust1", since = "1.0.0")] pub struct EscapeUnicode { @@ -236,8 +234,7 @@ impl fmt::Display for EscapeUnicode { /// This `struct` is created by the [`escape_default`] method on [`char`]. See /// its documentation for more. /// -/// [`escape_default`]: ../../std/primitive.char.html#method.escape_default -/// [`char`]: ../../std/primitive.char.html +/// [`escape_default`]: char::escape_default #[derive(Clone, Debug)] #[stable(feature = "rust1", since = "1.0.0")] pub struct EscapeDefault { @@ -345,8 +342,7 @@ impl fmt::Display for EscapeDefault { /// This `struct` is created by the [`escape_debug`] method on [`char`]. See its /// documentation for more. /// -/// [`escape_debug`]: ../../std/primitive.char.html#method.escape_debug -/// [`char`]: ../../std/primitive.char.html +/// [`escape_debug`]: char::escape_debug #[stable(feature = "char_escape_debug", since = "1.20.0")] #[derive(Clone, Debug)] pub struct EscapeDebug(EscapeDefault); @@ -380,8 +376,7 @@ impl fmt::Display for EscapeDebug { /// This `struct` is created by the [`to_lowercase`] method on [`char`]. See /// its documentation for more. /// -/// [`to_lowercase`]: ../../std/primitive.char.html#method.to_lowercase -/// [`char`]: ../../std/primitive.char.html +/// [`to_lowercase`]: char::to_lowercase #[stable(feature = "rust1", since = "1.0.0")] #[derive(Debug, Clone)] pub struct ToLowercase(CaseMappingIter); @@ -408,8 +403,7 @@ impl ExactSizeIterator for ToLowercase {} /// This `struct` is created by the [`to_uppercase`] method on [`char`]. See /// its documentation for more. /// -/// [`to_uppercase`]: ../../std/primitive.char.html#method.to_uppercase -/// [`char`]: ../../std/primitive.char.html +/// [`to_uppercase`]: char::to_uppercase #[stable(feature = "rust1", since = "1.0.0")] #[derive(Debug, Clone)] pub struct ToUppercase(CaseMappingIter); diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs index 638e83c3b939d..52f73c03e02d9 100644 --- a/library/core/src/fmt/mod.rs +++ b/library/core/src/fmt/mod.rs @@ -117,8 +117,6 @@ pub trait Write { /// /// This function will return an instance of [`Error`] on error. /// - /// [`Error`]: struct.Error.html - /// /// # Examples /// /// ``` @@ -146,9 +144,6 @@ pub trait Write { /// /// This function will return an instance of [`Error`] on error. /// - /// [`char`]: ../../std/primitive.char.html - /// [`Error`]: struct.Error.html - /// /// # Examples /// /// ``` @@ -218,9 +213,6 @@ impl Write for &mut W { /// To interact with a `Formatter`, you'll call various methods to change the /// various options related to formatting. For examples, please see the /// documentation of the methods defined on `Formatter` below. -/// -/// [`Debug`]: trait.Debug.html -/// [`Display`]: trait.Display.html #[allow(missing_debug_implementations)] #[stable(feature = "rust1", since = "1.0.0")] pub struct Formatter<'a> { @@ -378,7 +370,7 @@ impl<'a> Arguments<'a> { /// /// The [`format_args!`] macro will safely create an instance of this structure. /// The macro validates the format string at compile-time so usage of the -/// [`write`] and [`format`] functions can be safely performed. +/// [`write()`] and [`format()`] functions can be safely performed. /// /// You can use the `Arguments<'a>` that [`format_args!`] returns in `Debug` /// and `Display` contexts as seen below. The example also shows that `Debug` @@ -392,9 +384,7 @@ impl<'a> Arguments<'a> { /// assert_eq!(display, debug); /// ``` /// -/// [`format_args!`]: ../../std/macro.format_args.html -/// [`format`]: ../../std/fmt/fn.format.html -/// [`write`]: ../../std/fmt/fn.write.html +/// [`format()`]: ../../std/fmt/fn.format.html #[stable(feature = "rust1", since = "1.0.0")] #[derive(Copy, Clone)] pub struct Arguments<'a> { @@ -472,9 +462,7 @@ impl Display for Arguments<'_> { /// /// When used with the alternate format specifier `#?`, the output is pretty-printed. /// -/// For more information on formatters, see [the module-level documentation][module]. -/// -/// [module]: ../../std/fmt/index.html +/// For more information on formatters, see [the module-level documentation][self]. /// /// This trait can be used with `#[derive]` if all fields implement `Debug`. When /// `derive`d for structs, it will use the name of the `struct`, then `{`, then a @@ -535,8 +523,7 @@ impl Display for Arguments<'_> { /// `Debug` implementations using either `derive` or the debug builder API /// on [`Formatter`] support pretty-printing using the alternate flag: `{:#?}`. /// -/// [`debug_struct`]: ../../std/fmt/struct.Formatter.html#method.debug_struct -/// [`Formatter`]: ../../std/fmt/struct.Formatter.html +/// [`debug_struct`]: Formatter::debug_struct /// /// Pretty-printing with `#?`: /// @@ -618,14 +605,10 @@ pub use macros::Debug; /// Format trait for an empty format, `{}`. /// -/// `Display` is similar to [`Debug`][debug], but `Display` is for user-facing +/// `Display` is similar to [`Debug`], but `Display` is for user-facing /// output, and so cannot be derived. /// -/// [debug]: trait.Debug.html -/// -/// For more information on formatters, see [the module-level documentation][module]. -/// -/// [module]: ../../std/fmt/index.html +/// For more information on formatters, see [the module-level documentation][self]. /// /// # Examples /// @@ -697,9 +680,7 @@ pub trait Display { /// /// The alternate flag, `#`, adds a `0o` in front of the output. /// -/// For more information on formatters, see [the module-level documentation][module]. -/// -/// [module]: ../../std/fmt/index.html +/// For more information on formatters, see [the module-level documentation][self]. /// /// # Examples /// @@ -751,7 +732,7 @@ pub trait Octal { /// /// The alternate flag, `#`, adds a `0b` in front of the output. /// -/// For more information on formatters, see [the module-level documentation][module]. +/// For more information on formatters, see [the module-level documentation][self]. /// /// # Examples /// @@ -790,12 +771,6 @@ pub trait Octal { /// "l as binary is: 0b000000000000000000000001101011" /// ); /// ``` -/// -/// [module]: ../../std/fmt/index.html -/// [`i8`]: ../../std/primitive.i8.html -/// [`i128`]: ../../std/primitive.i128.html -/// [`isize`]: ../../std/primitive.isize.html -/// [`i32`]: ../../std/primitive.i32.html #[stable(feature = "rust1", since = "1.0.0")] pub trait Binary { /// Formats the value using the given formatter. @@ -813,9 +788,7 @@ pub trait Binary { /// /// The alternate flag, `#`, adds a `0x` in front of the output. /// -/// For more information on formatters, see [the module-level documentation][module]. -/// -/// [module]: ../../std/fmt/index.html +/// For more information on formatters, see [the module-level documentation][self]. /// /// # Examples /// @@ -868,9 +841,7 @@ pub trait LowerHex { /// /// The alternate flag, `#`, adds a `0x` in front of the output. /// -/// For more information on formatters, see [the module-level documentation][module]. -/// -/// [module]: ../../std/fmt/index.html +/// For more information on formatters, see [the module-level documentation][self]. /// /// # Examples /// @@ -918,9 +889,7 @@ pub trait UpperHex { /// The `Pointer` trait should format its output as a memory location. This is commonly presented /// as hexadecimal. /// -/// For more information on formatters, see [the module-level documentation][module]. -/// -/// [module]: ../../std/fmt/index.html +/// For more information on formatters, see [the module-level documentation][self]. /// /// # Examples /// @@ -967,9 +936,7 @@ pub trait Pointer { /// /// The `LowerExp` trait should format its output in scientific notation with a lower-case `e`. /// -/// For more information on formatters, see [the module-level documentation][module]. -/// -/// [module]: ../../std/fmt/index.html +/// For more information on formatters, see [the module-level documentation][self]. /// /// # Examples /// @@ -1018,9 +985,7 @@ pub trait LowerExp { /// /// The `UpperExp` trait should format its output in scientific notation with an upper-case `E`. /// -/// For more information on formatters, see [the module-level documentation][module]. -/// -/// [module]: ../../std/fmt/index.html +/// For more information on formatters, see [the module-level documentation][self]. /// /// # Examples /// @@ -1812,8 +1777,7 @@ impl<'a> Formatter<'a> { /// Creates a [`DebugStruct`] builder designed to assist with creation of /// [`fmt::Debug`] implementations for structs. /// - /// [`DebugStruct`]: ../../std/fmt/struct.DebugStruct.html - /// [`fmt::Debug`]: ../../std/fmt/trait.Debug.html + /// [`fmt::Debug`]: self::Debug /// /// # Examples /// diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index 3b9057b7e8377..d26f2124f15fd 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -28,9 +28,6 @@ macro_rules! panic { /// Like [`assert!`], this macro has a second form, where a custom /// panic message can be provided. /// -/// [`PartialEq`]: cmp/trait.PartialEq.html -/// [`assert!`]: macro.assert.html -/// /// # Examples /// /// ``` @@ -85,9 +82,6 @@ macro_rules! assert_eq { /// Like [`assert!`], this macro has a second form, where a custom /// panic message can be provided. /// -/// [`PartialEq`]: cmp/trait.PartialEq.html -/// [`assert!`]: macro.assert.html -/// /// # Examples /// /// ``` @@ -158,9 +152,6 @@ macro_rules! assert_ne { /// with `debug_assert!` is thus only encouraged after thorough profiling, and /// more importantly, only in safe code! /// -/// [`panic!`]: macro.panic.html -/// [`assert!`]: macro.assert.html -/// /// # Examples /// /// ``` @@ -196,8 +187,6 @@ macro_rules! debug_assert { /// expensive to be present in a release build but may be helpful during /// development. The result of expanding `debug_assert_eq!` is always type checked. /// -/// [`assert_eq!`]: ../std/macro.assert_eq.html -/// /// # Examples /// /// ``` @@ -223,8 +212,6 @@ macro_rules! debug_assert_eq { /// expensive to be present in a release build but may be helpful during /// development. The result of expanding `debug_assert_ne!` is always type checked. /// -/// [`assert_ne!`]: ../std/macro.assert_ne.html -/// /// # Examples /// /// ``` @@ -282,8 +269,6 @@ macro_rules! matches { /// Because of the early return, `try!` can only be used in functions that /// return [`Result`]. /// -/// [`Result`]: ../std/result/enum.Result.html -/// /// # Examples /// /// ``` @@ -354,10 +339,10 @@ macro_rules! r#try { /// /// See [`std::fmt`] for more information on the format string syntax. /// -/// [`std::fmt`]: ../std/fmt/index.html -/// [`std::fmt::Write`]: ../std/fmt/trait.Write.html +/// [`std::fmt`]: crate::fmt +/// [`std::fmt::Write`]: crate::fmt::Write /// [`std::io::Write`]: ../std/io/trait.Write.html -/// [`std::fmt::Result`]: ../std/fmt/type.Result.html +/// [`std::fmt::Result`]: crate::fmt::Result /// [`io::Result`]: ../std/io/type.Result.html /// /// # Examples @@ -426,9 +411,7 @@ macro_rules! write { /// For more information, see [`write!`]. For information on the format string syntax, see /// [`std::fmt`]. /// -/// [`write!`]: macro.write.html -/// [`std::fmt`]: ../std/fmt/index.html -/// +/// [`std::fmt`]: crate::fmt /// /// # Examples /// @@ -494,16 +477,12 @@ macro_rules! writeln { /// The unsafe counterpart of this macro is the [`unreachable_unchecked`] function, which /// will cause undefined behavior if the code is reached. /// -/// [`panic!`]: ../std/macro.panic.html -/// [`unreachable_unchecked`]: ../std/hint/fn.unreachable_unchecked.html -/// [`std::hint`]: ../std/hint/index.html +/// [`unreachable_unchecked`]: crate::hint::unreachable_unchecked /// /// # Panics /// /// This will always [`panic!`] /// -/// [`panic!`]: ../std/macro.panic.html -/// /// # Examples /// /// Match arms: @@ -637,8 +616,6 @@ macro_rules! unimplemented { /// implemented", `unimplemented!` makes no such claims. Its message is "not implemented". /// Also some IDEs will mark `todo!`s. /// -/// [`unimplemented!`]: macro.unimplemented.html -/// /// # Panics /// /// This will always [panic!](macro.panic.html) @@ -730,8 +707,6 @@ pub(crate) mod builtin { /// #[cfg(not(any(feature = "foo", feature = "bar")))] /// compile_error!("Either feature \"foo\" or \"bar\" must be enabled for this crate."); /// ``` - /// - /// [`panic!`]: ../std/macro.panic.html #[stable(feature = "compile_error_macro", since = "1.20.0")] #[rustc_builtin_macro] #[macro_export] @@ -769,12 +744,11 @@ pub(crate) mod builtin { /// /// For more information, see the documentation in [`std::fmt`]. /// - /// [`Display`]: ../std/fmt/trait.Display.html - /// [`Debug`]: ../std/fmt/trait.Debug.html - /// [`fmt::Arguments`]: ../std/fmt/struct.Arguments.html - /// [`std::fmt`]: ../std/fmt/index.html + /// [`Display`]: crate::fmt::Display + /// [`Debug`]: crate::fmt::Debug + /// [`fmt::Arguments`]: crate::fmt::Arguments + /// [`std::fmt`]: crate::fmt /// [`format!`]: ../std/macro.format.html - /// [`write!`]: ../std/macro.write.html /// [`println!`]: ../std/macro.println.html /// /// # Examples @@ -818,8 +792,6 @@ pub(crate) mod builtin { /// will be emitted. To not emit a compile error, use the [`option_env!`] /// macro instead. /// - /// [`option_env!`]: ../std/macro.option_env.html - /// /// # Examples /// /// ``` @@ -854,13 +826,11 @@ pub(crate) mod builtin { /// expand into an expression of type `Option<&'static str>` whose value is /// `Some` of the value of the environment variable. If the environment /// variable is not present, then this will expand to `None`. See - /// [`Option`][option] for more information on this type. + /// [`Option`][Option] for more information on this type. /// /// A compile time error is never emitted when using this macro regardless /// of whether the environment variable is present or not. /// - /// [option]: ../std/option/enum.Option.html - /// /// # Examples /// /// ``` @@ -946,9 +916,6 @@ pub(crate) mod builtin { /// but rather the first macro invocation leading up to the invocation /// of the `line!` macro. /// - /// [`column!`]: macro.column.html - /// [`file!`]: macro.file.html - /// /// # Examples /// /// ``` @@ -976,9 +943,6 @@ pub(crate) mod builtin { /// but rather the first macro invocation leading up to the invocation /// of the `column!` macro. /// - /// [`line!`]: macro.line.html - /// [`file!`]: macro.file.html - /// /// # Examples /// /// ``` @@ -999,15 +963,11 @@ pub(crate) mod builtin { /// With [`line!`] and [`column!`], these macros provide debugging information for /// developers about the location within the source. /// - /// /// The expanded expression has type `&'static str`, and the returned file /// is not the invocation of the `file!` macro itself, but rather the /// first macro invocation leading up to the invocation of the `file!` /// macro. /// - /// [`line!`]: macro.line.html - /// [`column!`]: macro.column.html - /// /// # Examples /// /// ``` @@ -1258,9 +1218,7 @@ pub(crate) mod builtin { /// be provided with or without arguments for formatting. See [`std::fmt`] /// for syntax for this form. /// - /// [`panic!`]: macro.panic.html - /// [`debug_assert!`]: macro.debug_assert.html - /// [`std::fmt`]: ../std/fmt/index.html + /// [`std::fmt`]: crate::fmt /// /// # Examples /// From ebac0e4727769dbb9da1f2ecfe353438defa8b78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Mon, 24 Aug 2020 00:14:04 +0200 Subject: [PATCH 13/16] tidy: remove redundant variable from check_if_error_code_is_test_in_explanation --- src/tools/tidy/src/error_codes_check.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/tools/tidy/src/error_codes_check.rs b/src/tools/tidy/src/error_codes_check.rs index 2fa0f12d7e8dc..8d015e916ebdc 100644 --- a/src/tools/tidy/src/error_codes_check.rs +++ b/src/tools/tidy/src/error_codes_check.rs @@ -47,9 +47,7 @@ fn check_error_code_explanation( invalid_compile_fail_format } -fn check_if_error_code_is_test_in_explanation(f: &str, err_code: &String) -> bool { - let mut can_be_ignored = false; - +fn check_if_error_code_is_test_in_explanation(f: &str, err_code: &str) -> bool { for line in f.lines() { let s = line.trim(); if s.starts_with("#### Note: this error code is no longer emitted by the compiler") { @@ -60,11 +58,11 @@ fn check_if_error_code_is_test_in_explanation(f: &str, err_code: &String) -> boo return true; } else if s.contains("(") { // It's very likely that we can't actually make it fail compilation... - can_be_ignored = true; + return true; } } } - can_be_ignored + false } macro_rules! some_or_continue { From ba6b4274b57ae38420e4bee951f29455204967e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Mon, 24 Aug 2020 00:43:50 +0200 Subject: [PATCH 14/16] unicode_table_generator: fix clippy::writeln_empty_string, clippy::useless_format, clippy:::for_kv_map --- src/tools/unicode-table-generator/src/main.rs | 2 +- src/tools/unicode-table-generator/src/raw_emitter.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tools/unicode-table-generator/src/main.rs b/src/tools/unicode-table-generator/src/main.rs index d2d1807b3bb22..218e9668df4ae 100644 --- a/src/tools/unicode-table-generator/src/main.rs +++ b/src/tools/unicode-table-generator/src/main.rs @@ -315,7 +315,7 @@ fn version() -> String { fn fmt_list(values: impl IntoIterator) -> String { let pieces = values.into_iter().map(|b| format!("{:?}, ", b)).collect::>(); let mut out = String::new(); - let mut line = format!("\n "); + let mut line = String::from("\n "); for piece in pieces { if line.len() + piece.len() < 98 { line.push_str(&piece); diff --git a/src/tools/unicode-table-generator/src/raw_emitter.rs b/src/tools/unicode-table-generator/src/raw_emitter.rs index 63cc29b670f6b..42e7e5fb40605 100644 --- a/src/tools/unicode-table-generator/src/raw_emitter.rs +++ b/src/tools/unicode-table-generator/src/raw_emitter.rs @@ -20,7 +20,7 @@ impl RawEmitter { if self.file.is_empty() || self.file.ends_with("\n\n") { return; } - writeln!(&mut self.file, "").unwrap(); + writeln!(&mut self.file).unwrap(); } fn emit_bitset(&mut self, ranges: &[Range]) { @@ -161,10 +161,10 @@ pub fn emit_codepoints(emitter: &mut RawEmitter, ranges: &[Range]) { if bitset.bytes_used <= skiplist.bytes_used { *emitter = bitset; - emitter.desc = format!("bitset"); + emitter.desc = String::from("bitset"); } else { *emitter = skiplist; - emitter.desc = format!("skiplist"); + emitter.desc = String::from("skiplist"); } } @@ -289,7 +289,7 @@ impl Canonicalized { // Remove the now-canonicalized word from other mappings, // to ensure that we deprioritize them in the next iteration of // the while loop. - for (_, mapped) in &mut mappings { + for mapped in mappings.values_mut() { let mut i = 0; while i != mapped.len() { if mapped[i].0 == *from { @@ -309,7 +309,7 @@ impl Canonicalized { // Remove the now-canonical word from other mappings, to ensure that // we deprioritize them in the next iteration of the while loop. - for (_, mapped) in &mut mappings { + for mapped in mappings.values_mut() { let mut i = 0; while i != mapped.len() { if mapped[i].0 == to { From a72500145b28a5aa584dab9d19565597aae72892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Mon, 24 Aug 2020 00:47:38 +0200 Subject: [PATCH 15/16] unstable-book-gen: fix clippy::single_char_pattern and clippy::iter_skip_next --- src/tools/tidy/src/error_codes_check.rs | 2 +- src/tools/unstable-book-gen/src/main.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/tidy/src/error_codes_check.rs b/src/tools/tidy/src/error_codes_check.rs index 8d015e916ebdc..82a5234ac5b24 100644 --- a/src/tools/tidy/src/error_codes_check.rs +++ b/src/tools/tidy/src/error_codes_check.rs @@ -56,7 +56,7 @@ fn check_if_error_code_is_test_in_explanation(f: &str, err_code: &str) -> bool { if s.starts_with("```") { if s.contains("compile_fail") && s.contains(err_code) { return true; - } else if s.contains("(") { + } else if s.contains('(') { // It's very likely that we can't actually make it fail compilation... return true; } diff --git a/src/tools/unstable-book-gen/src/main.rs b/src/tools/unstable-book-gen/src/main.rs index 11617911446ec..5d277e1c41f40 100644 --- a/src/tools/unstable-book-gen/src/main.rs +++ b/src/tools/unstable-book-gen/src/main.rs @@ -94,9 +94,9 @@ fn copy_recursive(from: &Path, to: &Path) { } fn main() { - let library_path_str = env::args_os().skip(1).next().expect("library path required"); - let src_path_str = env::args_os().skip(2).next().expect("source path required"); - let dest_path_str = env::args_os().skip(3).next().expect("destination path required"); + let library_path_str = env::args_os().nth(1).expect("library path required"); + let src_path_str = env::args_os().nth(2).expect("source path required"); + let dest_path_str = env::args_os().nth(3).expect("destination path required"); let library_path = Path::new(&library_path_str); let src_path = Path::new(&src_path_str); let dest_path = Path::new(&dest_path_str); From bc47f70f888afff97ffd7a4161bd45f9054dede6 Mon Sep 17 00:00:00 2001 From: JR Heard Date: Sun, 23 Aug 2020 16:38:23 -0700 Subject: [PATCH 16/16] doc: Fix typo in std::process::Child documentation --- library/std/src/process.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/process.rs b/library/std/src/process.rs index 6d94fa9ebfe6d..c42bc1096528b 100644 --- a/library/std/src/process.rs +++ b/library/std/src/process.rs @@ -126,7 +126,7 @@ use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner}; /// /// # Warning /// -/// On some system, calling [`wait`] or similar is necessary for the OS to +/// On some systems, calling [`wait`] or similar is necessary for the OS to /// release resources. A process that terminated but has not been waited on is /// still around as a "zombie". Leaving too many zombies around may exhaust /// global resources (for example process IDs).