1
Fork 0

Reformat use declarations.

The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
This commit is contained in:
Nicholas Nethercote 2024-07-29 08:13:50 +10:00
parent 118f9350c5
commit 84ac80f192
1865 changed files with 8367 additions and 9199 deletions

View file

@ -1,11 +1,12 @@
mod buffer;
use buffer::Buffer;
use crate::fmt;
use crate::io::{
self, uninlined_slow_read_byte, BorrowedCursor, BufRead, IoSliceMut, Read, Seek, SeekFrom,
SizeHint, SpecReadByte, DEFAULT_BUF_SIZE,
};
use buffer::Buffer;
/// The `BufReader<R>` struct adds buffering to any reader.
///

View file

@ -1,10 +1,8 @@
use crate::error;
use crate::fmt;
use crate::io::{
self, ErrorKind, IntoInnerError, IoSlice, Seek, SeekFrom, Write, DEFAULT_BUF_SIZE,
};
use crate::mem::{self, ManuallyDrop};
use crate::ptr;
use crate::{error, fmt, ptr};
/// Wraps a writer and buffers its output.
///

View file

@ -1,5 +1,6 @@
use crate::fmt;
use crate::io::{self, buffered::LineWriterShim, BufWriter, IntoInnerError, IoSlice, Write};
use crate::io::buffered::LineWriterShim;
use crate::io::{self, BufWriter, IntoInnerError, IoSlice, Write};
/// Wraps a writer and buffers output to it, flushing whenever a newline
/// (`0x0a`, `'\n'`) is detected.

View file

@ -1,6 +1,7 @@
use crate::io::{self, BufWriter, IoSlice, Write};
use core::slice::memchr;
use crate::io::{self, BufWriter, IoSlice, Write};
/// Private helper struct for implementing the line-buffered writing logic.
///
/// This shim temporarily wraps a BufWriter, and uses its internals to

View file

@ -8,16 +8,14 @@ mod linewritershim;
#[cfg(test)]
mod tests;
use crate::error;
use crate::fmt;
use crate::io::Error;
#[stable(feature = "bufwriter_into_parts", since = "1.56.0")]
pub use bufwriter::WriterPanicked;
use linewritershim::LineWriterShim;
#[stable(feature = "rust1", since = "1.0.0")]
pub use self::{bufreader::BufReader, bufwriter::BufWriter, linewriter::LineWriter};
use linewritershim::LineWriterShim;
#[stable(feature = "bufwriter_into_parts", since = "1.56.0")]
pub use bufwriter::WriterPanicked;
use crate::io::Error;
use crate::{error, fmt};
/// An error returned by [`BufWriter::into_inner`] which combines an error that
/// happened while writing out the buffer, and the buffered writer object

View file

@ -3,9 +3,8 @@ use crate::io::{
self, BorrowedBuf, BufReader, BufWriter, ErrorKind, IoSlice, LineWriter, SeekFrom,
};
use crate::mem::MaybeUninit;
use crate::panic;
use crate::sync::atomic::{AtomicUsize, Ordering};
use crate::thread;
use crate::{panic, thread};
/// A dummy reader intended at testing short-reads propagation.
pub struct ShortReader {

View file

@ -119,13 +119,12 @@ fn copy_specializes_from_slice() {
#[cfg(unix)]
mod io_benches {
use crate::fs::File;
use crate::fs::OpenOptions;
use test::Bencher;
use crate::fs::{File, OpenOptions};
use crate::io::prelude::*;
use crate::io::BufReader;
use test::Bencher;
#[bench]
fn bench_copy_buf_reader(b: &mut Bencher) {
let mut file_in = File::open("/dev/zero").expect("opening /dev/zero failed");

View file

@ -1,10 +1,9 @@
#[cfg(test)]
mod tests;
use crate::io::prelude::*;
use crate::alloc::Allocator;
use crate::cmp;
use crate::io::prelude::*;
use crate::io::{self, BorrowedCursor, ErrorKind, IoSlice, IoSliceMut, SeekFrom};
/// A `Cursor` wraps an in-memory buffer and provides it with a

View file

@ -11,10 +11,7 @@ mod repr_unpacked;
#[cfg(any(not(target_pointer_width = "64"), target_os = "uefi"))]
use repr_unpacked::Repr;
use crate::error;
use crate::fmt;
use crate::result;
use crate::sys;
use crate::{error, fmt, result, sys};
/// A specialized [`Result`] type for I/O operations.
///

View file

@ -102,10 +102,11 @@
//! to use a pointer type to store something that may hold an integer, some of
//! the time.
use super::{Custom, ErrorData, ErrorKind, RawOsError, SimpleMessage};
use core::marker::PhantomData;
use core::ptr::{self, NonNull};
use super::{Custom, ErrorData, ErrorKind, RawOsError, SimpleMessage};
// The 2 least-significant bits are used as tag.
const TAG_MASK: usize = 0b11;
const TAG_SIMPLE_MESSAGE: usize = 0b00;

View file

@ -1,10 +1,9 @@
use super::{const_io_error, Custom, Error, ErrorData, ErrorKind, Repr, SimpleMessage};
use crate::assert_matches::assert_matches;
use crate::error;
use crate::fmt;
use crate::mem::size_of;
use crate::sys::decode_error_kind;
use crate::sys::os::error_string;
use crate::{error, fmt};
#[test]
fn test_size() {
@ -95,7 +94,8 @@ fn test_errorkind_packing() {
#[test]
fn test_simple_message_packing() {
use super::{ErrorKind::*, SimpleMessage};
use super::ErrorKind::*;
use super::SimpleMessage;
macro_rules! check_simple_msg {
($err:expr, $kind:ident, $msg:literal) => {{
let e = &$err;

View file

@ -2,12 +2,9 @@
mod tests;
use crate::alloc::Allocator;
use crate::cmp;
use crate::collections::VecDeque;
use crate::fmt;
use crate::io::{self, BorrowedCursor, BufRead, IoSlice, IoSliceMut, Read, Seek, SeekFrom, Write};
use crate::mem;
use crate::str;
use crate::{cmp, fmt, mem, str};
// =============================================================================
// Forwarding implementations

View file

@ -297,15 +297,12 @@
#[cfg(test)]
mod tests;
use crate::cmp;
use crate::fmt;
use crate::mem::take;
use crate::ops::{Deref, DerefMut};
use crate::slice;
use crate::str;
use crate::sys;
#[unstable(feature = "read_buf", issue = "78485")]
pub use core::io::{BorrowedBuf, BorrowedCursor};
use core::slice::memchr;
pub(crate) use error::const_io_error;
#[stable(feature = "bufwriter_into_parts", since = "1.56.0")]
pub use self::buffered::WriterPanicked;
#[unstable(feature = "raw_os_error_ty", issue = "107792")]
@ -328,10 +325,9 @@ pub use self::{
stdio::{stderr, stdin, stdout, Stderr, StderrLock, Stdin, StdinLock, Stdout, StdoutLock},
util::{empty, repeat, sink, Empty, Repeat, Sink},
};
#[unstable(feature = "read_buf", issue = "78485")]
pub use core::io::{BorrowedBuf, BorrowedCursor};
pub(crate) use error::const_io_error;
use crate::mem::take;
use crate::ops::{Deref, DerefMut};
use crate::{cmp, fmt, slice, str, sys};
mod buffered;
pub(crate) mod copy;

View file

@ -3,11 +3,10 @@
#[cfg(test)]
mod tests;
use crate::io::prelude::*;
use crate::cell::{Cell, RefCell};
use crate::fmt;
use crate::fs::File;
use crate::io::prelude::*;
use crate::io::{
self, BorrowedCursor, BufReader, IoSlice, IoSliceMut, LineWriter, Lines, SpecReadByte,
};

View file

@ -1,7 +1,8 @@
use super::{repeat, BorrowedBuf, Cursor, SeekFrom};
use crate::cmp::{self, min};
use crate::io::{self, IoSlice, IoSliceMut, DEFAULT_BUF_SIZE};
use crate::io::{BufRead, BufReader, Read, Seek, Write};
use crate::io::{
self, BufRead, BufReader, IoSlice, IoSliceMut, Read, Seek, Write, DEFAULT_BUF_SIZE,
};
use crate::mem::MaybeUninit;
use crate::ops::Deref;

View file

@ -1,6 +1,5 @@
use crate::io::prelude::*;
use crate::io::{empty, repeat, sink, BorrowedBuf, Empty, Repeat, SeekFrom, Sink};
use crate::mem::MaybeUninit;
#[test]