mirror of
https://github.com/uutils/coreutils
synced 2024-11-17 02:08:09 +00:00
fix various doc warnings
This commit is contained in:
parent
b816e80e2f
commit
7f79fef2cd
18 changed files with 38 additions and 34 deletions
|
@ -1,4 +1,5 @@
|
|||
#![crate_name = "uu_csplit"]
|
||||
#![allow(rustdoc::private_intra_doc_links)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
@ -83,12 +84,12 @@ impl CsplitOptions {
|
|||
/// # Errors
|
||||
///
|
||||
/// - [`io::Error`] if there is some problem reading/writing from/to a file.
|
||||
/// - [`::CsplitError::LineOutOfRange`] if the line number pattern is larger than the number of input
|
||||
/// - [`CsplitError::LineOutOfRange`] if the line number pattern is larger than the number of input
|
||||
/// lines.
|
||||
/// - [`::CsplitError::LineOutOfRangeOnRepetition`], like previous but after applying the pattern
|
||||
/// - [`CsplitError::LineOutOfRangeOnRepetition`], like previous but after applying the pattern
|
||||
/// more than once.
|
||||
/// - [`::CsplitError::MatchNotFound`] if no line matched a regular expression.
|
||||
/// - [`::CsplitError::MatchNotFoundOnRepetition`], like previous but after applying the pattern
|
||||
/// - [`CsplitError::MatchNotFound`] if no line matched a regular expression.
|
||||
/// - [`CsplitError::MatchNotFoundOnRepetition`], like previous but after applying the pattern
|
||||
/// more than once.
|
||||
pub fn csplit<T>(
|
||||
options: &CsplitOptions,
|
||||
|
@ -243,7 +244,7 @@ impl<'a> SplitWriter<'a> {
|
|||
}
|
||||
|
||||
/// Writes the line to the current split, appending a newline character.
|
||||
/// If [`dev_null`] is true, then the line is discarded.
|
||||
/// If [`self.dev_null`] is true, then the line is discarded.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
|
@ -264,8 +265,8 @@ impl<'a> SplitWriter<'a> {
|
|||
}
|
||||
|
||||
/// Perform some operations after completing a split, i.e., either remove it
|
||||
/// if the [`::ELIDE_EMPTY_FILES_OPT`] option is enabled, or print how much bytes were written
|
||||
/// to it if [`::QUIET_OPT`] is disabled.
|
||||
/// if the [`options::ELIDE_EMPTY_FILES`] option is enabled, or print how much bytes were written
|
||||
/// to it if [`options::QUIET`] is disabled.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
|
@ -305,7 +306,7 @@ impl<'a> SplitWriter<'a> {
|
|||
///
|
||||
/// In addition to errors reading/writing from/to a file, if the line number
|
||||
/// `n` is greater than the total available lines, then a
|
||||
/// [`::CsplitError::LineOutOfRange`] error is returned.
|
||||
/// [`CsplitError::LineOutOfRange`] error is returned.
|
||||
fn do_to_line<I>(
|
||||
&mut self,
|
||||
pattern_as_str: &str,
|
||||
|
@ -354,9 +355,9 @@ impl<'a> SplitWriter<'a> {
|
|||
/// # Errors
|
||||
///
|
||||
/// In addition to errors reading/writing from/to a file, the following errors may be returned:
|
||||
/// - if no line matched, an [`::CsplitError::MatchNotFound`].
|
||||
/// - if no line matched, an [`CsplitError::MatchNotFound`].
|
||||
/// - if there are not enough lines to accommodate the offset, an
|
||||
/// [`::CsplitError::LineOutOfRange`].
|
||||
/// [`CsplitError::LineOutOfRange`].
|
||||
fn do_to_match<I>(
|
||||
&mut self,
|
||||
pattern_as_str: &str,
|
||||
|
@ -512,7 +513,7 @@ where
|
|||
self.size = size;
|
||||
}
|
||||
|
||||
/// Add a line to the buffer. If the buffer has [`size`] elements, then its head is removed and
|
||||
/// Add a line to the buffer. If the buffer has [`self.size`] elements, then its head is removed and
|
||||
/// the new line is pushed to the buffer. The removed head is then available in the returned
|
||||
/// option.
|
||||
fn add_line_to_buffer(&mut self, ln: usize, line: String) -> Option<String> {
|
||||
|
|
|
@ -88,7 +88,7 @@ impl Iterator for ExecutePatternIter {
|
|||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// If a pattern is incorrect, a [`::CsplitError::InvalidPattern`] error is returned, which may be
|
||||
/// If a pattern is incorrect, a [`CsplitError::InvalidPattern`] error is returned, which may be
|
||||
/// due to, e.g.,:
|
||||
/// - an invalid regular expression;
|
||||
/// - an invalid number for, e.g., the offset.
|
||||
|
|
|
@ -377,9 +377,9 @@ fn set_system_datetime(_date: DateTime<Utc>) -> UResult<()> {
|
|||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
||||
/// System call to set date (unix).
|
||||
/// See here for more:
|
||||
/// https://doc.rust-lang.org/libc/i686-unknown-linux-gnu/libc/fn.clock_settime.html
|
||||
/// https://linux.die.net/man/3/clock_settime
|
||||
/// https://www.gnu.org/software/libc/manual/html_node/Time-Types.html
|
||||
/// `<https://doc.rust-lang.org/libc/i686-unknown-linux-gnu/libc/fn.clock_settime.html>`
|
||||
/// `<https://linux.die.net/man/3/clock_settime>`
|
||||
/// `<https://www.gnu.org/software/libc/manual/html_node/Time-Types.html>`
|
||||
fn set_system_datetime(date: DateTime<Utc>) -> UResult<()> {
|
||||
let timespec = timespec {
|
||||
tv_sec: date.timestamp() as _,
|
||||
|
|
|
@ -86,7 +86,7 @@ impl UError for ParseError {
|
|||
}
|
||||
}
|
||||
|
||||
/// Some flags specified as part of a conv=CONV[,CONV]... block
|
||||
/// Some flags specified as part of a conv=CONV\[,CONV\]... block
|
||||
/// relate to the input file, others to the output file.
|
||||
#[derive(Debug, PartialEq)]
|
||||
enum ConvFlag {
|
||||
|
|
|
@ -9,7 +9,7 @@ const ZERO: u8 = 0;
|
|||
/// Returns an iterator over the lines of the given reader.
|
||||
///
|
||||
/// The iterator returned from this function will yield instances of
|
||||
/// [`io::Result`]<[`Vec`]<[`u8`]>>, representing the bytes of the line
|
||||
/// [`std::io::Result`]<[`Vec`]<[`u8`]>>, representing the bytes of the line
|
||||
/// *including* the null character (with the possible exception of the
|
||||
/// last line, which may not have one).
|
||||
///
|
||||
|
|
|
@ -12,7 +12,7 @@ pub enum ParseError {
|
|||
Overflow,
|
||||
}
|
||||
/// Parses obsolete syntax
|
||||
/// head -NUM[kmzv] // spell-checker:disable-line
|
||||
/// head -NUM\[kmzv\] // spell-checker:disable-line
|
||||
pub fn parse_obsolete(src: &str) -> Option<Result<impl Iterator<Item = OsString>, ParseError>> {
|
||||
let mut chars = src.char_indices();
|
||||
if let Some((_, '-')) = chars.next() {
|
||||
|
|
|
@ -65,7 +65,7 @@ where
|
|||
/// Like `std::io::Take`, but for lines instead of bytes.
|
||||
///
|
||||
/// This struct is generally created by calling [`take_lines`] on a
|
||||
/// reader. Please see the documentation of [`take`] for more
|
||||
/// reader. Please see the documentation of [`take_lines`] for more
|
||||
/// details.
|
||||
pub struct TakeLines<T> {
|
||||
inner: T,
|
||||
|
|
|
@ -681,7 +681,7 @@ fn copy(from: &Path, to: &Path, b: &Behavior) -> UResult<()> {
|
|||
/// Return true if a file is necessary to copy. This is the case when:
|
||||
///
|
||||
/// - _from_ or _to_ is nonexistent;
|
||||
/// - either file has a sticky bit or set[ug]id bit, or the user specified one;
|
||||
/// - either file has a sticky bit or set\[ug\]id bit, or the user specified one;
|
||||
/// - either file isn't a regular file;
|
||||
/// - the sizes of _from_ and _to_ differ;
|
||||
/// - _to_'s owner differs from intended; or
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
//! The [`Number`] enumeration represents the possible values for the
|
||||
//! start, increment, and end values for `seq`. These may be integers,
|
||||
//! floating point numbers, negative zero, etc. A [`Number`] can be
|
||||
//! parsed from a string by calling [`parse`].
|
||||
//! parsed from a string by calling [`str::parse`].
|
||||
use num_traits::Zero;
|
||||
|
||||
use crate::extendedbigdecimal::ExtendedBigDecimal;
|
||||
|
@ -77,7 +77,7 @@ impl Number {
|
|||
///
|
||||
/// This struct can be used to represent a number along with information
|
||||
/// on how many significant digits to use when displaying the number.
|
||||
/// The [`num_integral_digits`] field also includes the width needed to
|
||||
/// The [`PreciseNumber::num_integral_digits`] field also includes the width needed to
|
||||
/// display the "-" character for a negative number.
|
||||
///
|
||||
/// You can get an instance of this struct by calling [`str::parse`].
|
||||
|
|
|
@ -29,7 +29,7 @@ use rand_core::{impls, Error, RngCore};
|
|||
/// have enough data, will only be reported through [`try_fill_bytes`].
|
||||
/// The other [`RngCore`] methods will panic in case of an error.
|
||||
///
|
||||
/// [`OsRng`]: crate::rngs::OsRng
|
||||
/// [`OsRng`]: rand::rngs::OsRng
|
||||
/// [`try_fill_bytes`]: RngCore::try_fill_bytes
|
||||
#[derive(Debug)]
|
||||
pub struct ReadRng<R> {
|
||||
|
|
|
@ -13,7 +13,7 @@ pub const BLOCK_SIZE: u64 = 1 << 16;
|
|||
///
|
||||
/// Each chunk is a [`Vec`]<[`u8`]> of size [`BLOCK_SIZE`] (except
|
||||
/// possibly the last chunk, which might be smaller). Each call to
|
||||
/// [`next`] will seek backwards through the given file.
|
||||
/// [`ReverseChunks::next`] will seek backwards through the given file.
|
||||
pub struct ReverseChunks<'a> {
|
||||
/// The file to iterate over, by blocks, from the end to the beginning.
|
||||
file: &'a File,
|
||||
|
|
|
@ -11,7 +11,7 @@ pub enum ParseError {
|
|||
Overflow,
|
||||
}
|
||||
/// Parses obsolete syntax
|
||||
/// tail -NUM[kmzv] // spell-checker:disable-line
|
||||
/// tail -NUM\[kmzv\] // spell-checker:disable-line
|
||||
pub fn parse_obsolete(src: &str) -> Option<Result<impl Iterator<Item = OsString>, ParseError>> {
|
||||
let mut chars = src.char_indices();
|
||||
if let Some((_, '-')) = chars.next() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! Traits and implementations for iterating over lines in a file-like object.
|
||||
//!
|
||||
//! This module provides a [`WordCountable`] trait and implementations
|
||||
//! for some common file-like objects. Use the [`WordCountable::lines`]
|
||||
//! for some common file-like objects. Use the [`WordCountable::buffered`]
|
||||
//! method to get an iterator over lines of a file-like object.
|
||||
use std::fs::File;
|
||||
use std::io::{BufRead, BufReader, Read, StdinLock};
|
||||
|
|
|
@ -9,7 +9,7 @@ use nix::{fcntl::SpliceFFlags, sys::uio::IoVec};
|
|||
|
||||
pub use nix::{Error, Result};
|
||||
|
||||
/// A wrapper around [`nix::unistd::Pipe`] that ensures the pipe is cleaned up.
|
||||
/// A wrapper around [`nix::unistd::pipe`] that ensures the pipe is cleaned up.
|
||||
///
|
||||
/// Returns two `File` objects: everything written to the second can be read
|
||||
/// from the first.
|
||||
|
|
|
@ -33,6 +33,9 @@ use std::collections::VecDeque;
|
|||
/// let expected = VecDeque::from_iter([1, 2].iter());
|
||||
/// assert_eq!(expected, actual);
|
||||
/// ```
|
||||
///
|
||||
/// [`push_back`]: struct.RingBuffer.html#method.push_back
|
||||
/// [`from_iter`]: struct.RingBuffer.html#method.from_iter
|
||||
pub struct RingBuffer<T> {
|
||||
pub data: VecDeque<T>,
|
||||
size: usize,
|
||||
|
|
|
@ -221,7 +221,7 @@ macro_rules! show_usage_error(
|
|||
})
|
||||
);
|
||||
|
||||
/// Display an error and [`exit!`]
|
||||
/// Display an error and [`std::process::exit`]
|
||||
///
|
||||
/// Displays the provided error message using [`show_error!`], then invokes
|
||||
/// [`std::process::exit`] with the provided exit code.
|
||||
|
|
|
@ -129,7 +129,7 @@ pub enum BackupMode {
|
|||
/// Backup error types.
|
||||
///
|
||||
/// Errors are currently raised by [`determine_backup_mode`] only. All errors
|
||||
/// are implemented as [`UCustomError`] for uniform handling across utilities.
|
||||
/// are implemented as [`UError`] for uniform handling across utilities.
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub enum BackupError {
|
||||
/// An invalid argument (e.g. 'foo') was given as backup type. First
|
||||
|
|
|
@ -26,11 +26,11 @@ fn is_broken_pipe(info: &PanicInfo) -> bool {
|
|||
///
|
||||
/// For background discussions on `SIGPIPE` handling, see
|
||||
///
|
||||
/// * https://github.com/uutils/coreutils/issues/374
|
||||
/// * https://github.com/uutils/coreutils/pull/1106
|
||||
/// * https://github.com/rust-lang/rust/issues/62569
|
||||
/// * https://github.com/BurntSushi/ripgrep/issues/200
|
||||
/// * https://github.com/crev-dev/cargo-crev/issues/287
|
||||
/// * `<https://github.com/uutils/coreutils/issues/374>`
|
||||
/// * `<https://github.com/uutils/coreutils/pull/1106>`
|
||||
/// * `<https://github.com/rust-lang/rust/issues/62569>`
|
||||
/// * `<https://github.com/BurntSushi/ripgrep/issues/200>`
|
||||
/// * `<https://github.com/crev-dev/cargo-crev/issues/287>`
|
||||
///
|
||||
pub fn mute_sigpipe_panic() {
|
||||
let hook = panic::take_hook();
|
||||
|
|
Loading…
Reference in a new issue