mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-02 22:17:45 +00:00
refactor/polish ~ fix cargo clippy
complaints (iter_nth_zero)
This commit is contained in:
parent
ce0bb218a7
commit
ecc895e7a1
6 changed files with 6 additions and 6 deletions
|
@ -117,7 +117,7 @@ pub fn uumain(mut args: Vec<String>) -> i32 {
|
|||
|
||||
fn sanitize_input(args: &mut Vec<String>) -> Option<String> {
|
||||
for i in 0..args.len() {
|
||||
let first = args[i].chars().nth(0).unwrap();
|
||||
let first = args[i].chars().next().unwrap();
|
||||
if first != '-' {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ macro_rules! prompt_yes(
|
|||
crash_if_err!(1, stdout().flush());
|
||||
let mut s = String::new();
|
||||
match stdin().read_line(&mut s) {
|
||||
Ok(_) => match s.char_indices().nth(0) {
|
||||
Ok(_) => match s.char_indices().next() {
|
||||
Some((_, x)) => x == 'y' || x == 'Y',
|
||||
_ => false
|
||||
},
|
||||
|
|
|
@ -569,7 +569,7 @@ FILENUM is 1 or 2, corresponding to FILE1 or FILE2",
|
|||
if let Some(value) = matches.value_of("t") {
|
||||
settings.separator = match value.len() {
|
||||
0 => Sep::Line,
|
||||
1 => Sep::Char(value.chars().nth(0).unwrap()),
|
||||
1 => Sep::Char(value.chars().next().unwrap()),
|
||||
_ => crash!(1, "multi-character tab {}", value),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -325,7 +325,7 @@ fn link(src: &PathBuf, dst: &PathBuf, settings: &Settings) -> Result<()> {
|
|||
fn read_yes() -> bool {
|
||||
let mut s = String::new();
|
||||
match stdin().read_line(&mut s) {
|
||||
Ok(_) => match s.char_indices().nth(0) {
|
||||
Ok(_) => match s.char_indices().next() {
|
||||
Some((_, x)) => x == 'y' || x == 'Y',
|
||||
_ => false,
|
||||
},
|
||||
|
|
|
@ -130,7 +130,7 @@ for details about the options it supports.",
|
|||
// 'mknod /dev/rst0 character 18 0'.
|
||||
let ch = args[1]
|
||||
.chars()
|
||||
.nth(0)
|
||||
.next()
|
||||
.expect("Failed to get the first char");
|
||||
|
||||
if ch == 'p' {
|
||||
|
|
|
@ -399,7 +399,7 @@ fn rename(from: &PathBuf, to: &PathBuf, b: &Behaviour) -> Result<()> {
|
|||
fn read_yes() -> bool {
|
||||
let mut s = String::new();
|
||||
match stdin().read_line(&mut s) {
|
||||
Ok(_) => match s.chars().nth(0) {
|
||||
Ok(_) => match s.chars().next() {
|
||||
Some(x) => x == 'y' || x == 'Y',
|
||||
_ => false,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue