Rollup merge of #126717 - nnethercote:rustfmt-use-pre-cleanups, r=jie… · model-checking/verify-rust-std@0829ab8 (original) (raw)

File tree

25 files changed

lines changed

25 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
1 -// Based on
2 -// https://github.com/matthieu-m/rfc2580/blob/b58d1d3cba0d4b5e859d3617ea2d0943aaa31329/examples/thin.rs
3 -// by matthieu-m
1 +//! Based on
2 +//! https://github.com/matthieu-m/rfc2580/blob/b58d1d3cba0d4b5e859d3617ea2d0943aaa31329/examples/thin.rs
3 +//! by matthieu-m
4 +
4 5 use crate::alloc::{self, Layout, LayoutError};
5 6 use core::error::Error;
6 7 use core::fmt::{self, Debug, Display, Formatter};
Original file line number Diff line number Diff line change
@@ -154,6 +154,7 @@
154 154 //! }
155 155 //! vec.truncate(write_idx);
156 156 //! ```
157 +
157 158 use crate::alloc::{handle_alloc_error, Global};
158 159 use core::alloc::Allocator;
159 160 use core::alloc::Layout;
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
17 17 //! Note: Because the term "leading byte" can sometimes be ambiguous (for
18 18 //! example, it could also refer to the first byte of a slice), we'll often use
19 19 //! the term "non-continuation byte" to refer to these bytes in the code.
20 +
20 21 use core::intrinsics::unlikely;
21 22
22 23 const USIZE_SIZE: usize = core::mem::size_of::<usize>();
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ use std::sync::atomic::{AtomicUsize, Ordering::SeqCst};
3 3 #[cfg(not(panic = "abort"))]
4 4 mod drop_checks {
5 5 //! These tests mainly make sure the elements are correctly dropped.
6 +
6 7 use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering::SeqCst};
7 8
8 9 #[derive(Debug)]
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
1 1 // FIXME: These tests are all excellent candidates for AFL fuzz testing
2 +
2 3 use core:🥅:{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
3 4 use core::str::FromStr;
4 5
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@
27 27 //! standard. That is why they accept wildly diverse inputs or may seem to duplicate other tests.
28 28 //! Please consider this carefully when adding, removing, or reorganizing these tests. They are
29 29 //! here so that it is clear what tests are required by the standard and what can be changed.
30 +
30 31 use ::core::str::FromStr;
31 32
32 33 // IEEE 754 for many tests is applied to specific bit patterns.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
1 1 // edition:2021
2 +
2 3 use core::{
3 4 marker::PhantomPinned,
4 5 mem::{drop as stuff, transmute},
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
1 1 //! Unwinding panics for Miri.
2 +
2 3 use alloc::boxed::Box;
3 4 use core::any::Any;
4 5
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
1 -// Code taken from the `packed_simd` crate
2 -// Run this code with `cargo test --example dot_product`
3 -//use std::iter::zip;
1 +//! Code taken from the `packed_simd` crate.
2 +//! Run this code with `cargo test --example dot_product`.
4 3
5 4 #![feature(array_chunks)]
6 5 #![feature(slice_as_chunks)]
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
1 1 //! Assignment operators
2 +
2 3 use super::*;
3 4 use core::ops::{AddAssign, MulAssign}; // commutative binary op-assignment
4 5 use core::ops::{BitAndAssign, BitOrAssign, BitXorAssign}; // commutative bit binary op-assignment
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
2 2 //! Ideally, Rust would take care of this itself,
3 3 //! and method calls usually handle the LHS implicitly.
4 4 //! But this is not the case with arithmetic ops.
5 +
5 6 use super::*;
6 7
7 8 macro_rules! deref_lhs {
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
6 6 //! outside this crate.
7 7 //!
8 8 //! [`collections`]: crate::collections
9 +
9 10 #[allow(deprecated)]
10 11 use super::{BuildHasher, Hasher, SipHasher13};
11 12 use crate::cell::Cell;
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
1 -///! An encapsulation of `BufReader`'s buffer management logic.
2 -///
3 -/// This module factors out the basic functionality of `BufReader` in order to protect two core
4 -/// invariants:
5 -/// * `filled` bytes of `buf` are always initialized
6 -/// * `pos` is always <= `filled`
7 -/// Since this module encapsulates the buffer management logic, we can ensure that the range
8 -/// `pos..filled` is always a valid index into the initialized region of the buffer. This means
9 -/// that user code which wants to do reads from a `BufReader` via `buffer` + `consume` can do so
10 -/// without encountering any runtime bounds checks.
1 +//! An encapsulation of `BufReader`'s buffer management logic.
2 +//!
3 +//! This module factors out the basic functionality of `BufReader` in order to protect two core
4 +//! invariants:
5 +//! * `filled` bytes of `buf` are always initialized
6 +//! * `pos` is always <= `filled`
7 +//! Since this module encapsulates the buffer management logic, we can ensure that the range
8 +//! `pos..filled` is always a valid index into the initialized region of the buffer. This means
9 +//! that user code which wants to do reads from a `BufReader` via `buffer` + `consume` can do so
10 +//! without encountering any runtime bounds checks.
11 +
11 12 use crate::cmp;
12 13 use crate::io::{self, BorrowedBuf, Read};
13 14 use crate::mem::MaybeUninit;
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
1 -/// The underlying OsString/OsStr implementation on Windows is a
2 -/// wrapper around the "WTF-8" encoding; see the `wtf8` module for more.
1 +//! The underlying OsString/OsStr implementation on Windows is a
2 +//! wrapper around the "WTF-8" encoding; see the `wtf8` module for more.
3 +
3 4 use crate::borrow::Cow;
4 5 use crate::collections::TryReserveError;
5 6 use crate::fmt;
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
1 1 //! Thread implementation backed by μITRON tasks. Assumes `acre_tsk` and
2 2 //! `exd_tsk` are available.
3 +
3 4 use super::{
4 5 abi,
5 6 error::{expect_success, expect_success_aborting, ItronError},
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
1 1 //! `solid_fs.h`
2 +
2 3 use crate::os::raw::{c_char, c_int, c_uchar};
3 4 pub use libc::{
4 5 ino_t, off_t, stat, time_t, O_APPEND, O_CREAT, O_EXCL, O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY,
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
1 1 //! Emulated wait status for non-Unix #[cfg(unix) platforms
2 2 //!
3 3 //! Separate module to facilitate testing against a real Unix implementation.
4 +
4 5 use crate::ffi::c_int;
5 6 use crate::fmt;
6 7 use crate::num::NonZero;
Original file line number Diff line number Diff line change
@@ -475,6 +475,7 @@ mod cgroups {
475 475 //! * cgroup v2 in non-standard mountpoints
476 476 //! * paths containing control characters or spaces, since those would be escaped in procfs
477 477 //! output and we don't unescape
478 +
478 479 use crate::borrow::Cow;
479 480 use crate::ffi::OsString;
480 481 use crate::fs::{try_exists, File};
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
1 1 //! POSIX conditional variable implementation based on user-space wait queues.
2 +
2 3 use crate::sys::pal::itron::{
3 4 abi, error::expect_success_aborting, spin::SpinMutex, task, time::with_tmos_strong,
4 5 };
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
1 1 //! Mutex implementation backed by μITRON mutexes. Assumes `acre_mtx` and
2 2 //! `TA_INHERIT` are available.
3 +
3 4 use crate::sys::pal::itron::{
4 5 abi,
5 6 error::{expect_success, expect_success_aborting, fail, ItronError},
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
1 1 //! A readers-writer lock implementation backed by the SOLID kernel extension.
2 +
2 3 use crate::sys::pal::{
3 4 abi,
4 5 itron::{
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
2 2
3 3 //! Note that this test changes the current directory so
4 4 //! should not be in the same process as other tests.
5 +
5 6 use std::env;
6 7 use std::fs;
7 8 use std::path::{Path, PathBuf};
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
1 1 //! Benchmarking module.
2 +
2 3 use super::{
3 4 event::CompletedTest,
4 5 options::BenchMode,
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
1 1 //! Helper module which helps to determine amount of threads to be used
2 2 //! during tests execution.
3 +
3 4 use std::{env, num::NonZero, thread};
4 5
5 6 pub fn get_concurrency() -> usize {
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
1 1 //! Benchmark metrics.
2 +
2 3 use std::collections::BTreeMap;
3 4
4 5 #[derive(Clone, PartialEq, Debug, Copy)]