1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Merge pull request #4492 from cakebaker/od_fix_details

od: fix some minor details suggested by clippy::pedantic
This commit is contained in:
Sylvestre Ledru 2023-03-10 16:13:54 +01:00 committed by GitHub
commit 7c0063ae3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 15 deletions

View file

@ -56,7 +56,7 @@ where
I: PeekRead, I: PeekRead,
{ {
/// calls `peek_read` on the internal stream to (re)fill the buffer. Returns a /// calls `peek_read` on the internal stream to (re)fill the buffer. Returns a
/// MemoryDecoder providing access to the result or returns an i/o error. /// `MemoryDecoder` providing access to the result or returns an i/o error.
pub fn peek_read(&mut self) -> io::Result<MemoryDecoder> { pub fn peek_read(&mut self) -> io::Result<MemoryDecoder> {
match self match self
.input .input
@ -81,7 +81,7 @@ impl<'a, I> HasError for InputDecoder<'a, I>
where where
I: HasError, I: HasError,
{ {
/// calls has_error on the internal stream. /// calls `has_error` on the internal stream.
fn has_error(&self) -> bool { fn has_error(&self) -> bool {
self.input.has_error() self.input.has_error()
} }

View file

@ -28,17 +28,17 @@ mod prn_int;
use std::cmp; use std::cmp;
use std::fmt::Write; use std::fmt::Write;
use crate::byteorder_io::*; use crate::byteorder_io::ByteOrder;
use crate::formatteriteminfo::*; use crate::formatteriteminfo::FormatWriter;
use crate::inputdecoder::{InputDecoder, MemoryDecoder}; use crate::inputdecoder::{InputDecoder, MemoryDecoder};
use crate::inputoffset::{InputOffset, Radix}; use crate::inputoffset::{InputOffset, Radix};
use crate::multifilereader::*; use crate::multifilereader::{HasError, InputSource, MultifileReader};
use crate::output_info::OutputInfo; use crate::output_info::OutputInfo;
use crate::parse_formats::{parse_format_flags, ParsedFormatterItemInfo}; use crate::parse_formats::{parse_format_flags, ParsedFormatterItemInfo};
use crate::parse_inputs::{parse_inputs, CommandLineInputs}; use crate::parse_inputs::{parse_inputs, CommandLineInputs};
use crate::parse_nrofbytes::parse_number_of_bytes; use crate::parse_nrofbytes::parse_number_of_bytes;
use crate::partialreader::*; use crate::partialreader::PartialReader;
use crate::peekreader::*; use crate::peekreader::{PeekRead, PeekReader};
use crate::prn_char::format_ascii_dump; use crate::prn_char::format_ascii_dump;
use clap::ArgAction; use clap::ArgAction;
use clap::{crate_version, parser::ValueSource, Arg, ArgMatches, Command}; use clap::{crate_version, parser::ValueSource, Arg, ArgMatches, Command};
@ -48,10 +48,9 @@ use uucore::parse_size::ParseSizeError;
use uucore::{format_usage, help_about, help_section, help_usage, show_error, show_warning}; use uucore::{format_usage, help_about, help_section, help_usage, show_error, show_warning};
const PEEK_BUFFER_SIZE: usize = 4; // utf-8 can be 4 bytes const PEEK_BUFFER_SIZE: usize = 4; // utf-8 can be 4 bytes
const ABOUT: &str = help_about!("od.md"); const ABOUT: &str = help_about!("od.md");
const USAGE: &str = help_usage!("od.md"); const USAGE: &str = help_usage!("od.md");
const AFTER_HELP: &str = help_section!("after help", "od.md"); const AFTER_HELP: &str = help_section!("after help", "od.md");
pub(crate) mod options { pub(crate) mod options {
@ -460,7 +459,7 @@ pub fn uu_app() -> Command {
) )
} }
/// Loops through the input line by line, calling print_bytes to take care of the output. /// Loops through the input line by line, calling `print_bytes` to take care of the output.
fn odfunc<I>( fn odfunc<I>(
input_offset: &mut InputOffset, input_offset: &mut InputOffset,
input_decoder: &mut InputDecoder<I>, input_decoder: &mut InputDecoder<I>,

View file

@ -139,7 +139,7 @@ impl OutputInfo {
/// ``` /// ```
/// ///
/// This algorithm assumes the size of all types is a power of 2 (1, 2, 4, 8, 16, ...) /// This algorithm assumes the size of all types is a power of 2 (1, 2, 4, 8, 16, ...)
/// Increase MAX_BYTES_PER_UNIT to allow larger types. /// Increase `MAX_BYTES_PER_UNIT` to allow larger types.
fn calculate_alignment( fn calculate_alignment(
sf: &dyn TypeSizeInfo, sf: &dyn TypeSizeInfo,
byte_size_block: usize, byte_size_block: usize,

View file

@ -90,8 +90,8 @@ pub fn parse_inputs(matches: &dyn CommandLineOpts) -> Result<CommandLineInputs,
/// interprets inputs when --traditional is on the command line /// interprets inputs when --traditional is on the command line
/// ///
/// normally returns CommandLineInputs::FileAndOffset, but if no offset is found, /// normally returns `CommandLineInputs::FileAndOffset`, but if no offset is found,
/// it returns CommandLineInputs::FileNames (also to differentiate from the offset == 0) /// it returns `CommandLineInputs::FileNames` (also to differentiate from the offset == 0)
pub fn parse_inputs_traditional(input_strings: &[&str]) -> Result<CommandLineInputs, String> { pub fn parse_inputs_traditional(input_strings: &[&str]) -> Result<CommandLineInputs, String> {
match input_strings.len() { match input_strings.len() {
0 => Ok(CommandLineInputs::FileNames(vec!["-".to_string()])), 0 => Ok(CommandLineInputs::FileNames(vec!["-".to_string()])),

View file

@ -1,6 +1,6 @@
use std::str::from_utf8; use std::str::from_utf8;
use crate::formatteriteminfo::*; use crate::formatteriteminfo::{FormatWriter, FormatterItemInfo};
pub static FORMAT_ITEM_A: FormatterItemInfo = FormatterItemInfo { pub static FORMAT_ITEM_A: FormatterItemInfo = FormatterItemInfo {
byte_size: 1, byte_size: 1,

View file

@ -3,7 +3,7 @@ use std::f32;
use std::f64; use std::f64;
use std::num::FpCategory; use std::num::FpCategory;
use crate::formatteriteminfo::*; use crate::formatteriteminfo::{FormatWriter, FormatterItemInfo};
pub static FORMAT_ITEM_F16: FormatterItemInfo = FormatterItemInfo { pub static FORMAT_ITEM_F16: FormatterItemInfo = FormatterItemInfo {
byte_size: 2, byte_size: 2,