mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47:45 +00:00
Merge pull request #1307 from PaulCapron/master
Remove some useless BufReader wrappers around stdin
This commit is contained in:
commit
39b5760f8e
4 changed files with 9 additions and 8 deletions
|
@ -39,7 +39,7 @@ use clap::{App, Arg, ArgMatches};
|
|||
use quick_error::ResultExt;
|
||||
use std::collections::HashSet;
|
||||
use std::fs;
|
||||
use std::io::{stdin, stdout, BufRead, BufReader, Write};
|
||||
use std::io::{stdin, stdout, Write};
|
||||
use std::io;
|
||||
use std::path::{Path, PathBuf, StripPrefixError};
|
||||
use std::str::FromStr;
|
||||
|
@ -120,7 +120,7 @@ macro_rules! prompt_yes(
|
|||
print!(" [y/N]: ");
|
||||
crash_if_err!(1, stdout().flush());
|
||||
let mut s = String::new();
|
||||
match BufReader::new(stdin()).read_line(&mut s) {
|
||||
match stdin().read_line(&mut s) {
|
||||
Ok(_) => match s.char_indices().nth(0) {
|
||||
Some((_, x)) => x == 'y' || x == 'Y',
|
||||
_ => false
|
||||
|
|
|
@ -23,7 +23,7 @@ use rand::distributions::{Distribution, Uniform};
|
|||
use rand::{SeedableRng, thread_rng};
|
||||
use rand::rngs::SmallRng;
|
||||
use std::cmp::{max, min};
|
||||
use std::io::{stdin, BufRead, BufReader};
|
||||
use std::io::{stdin, BufRead};
|
||||
use std::num::Wrapping;
|
||||
use std::mem::swap;
|
||||
|
||||
|
@ -163,7 +163,8 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
let matches = new_coreopts!(SYNTAX, SUMMARY, LONG_HELP).parse(args);
|
||||
|
||||
if matches.free.is_empty() {
|
||||
for line in BufReader::new(stdin()).lines() {
|
||||
let stdin = stdin();
|
||||
for line in stdin.lock().lines() {
|
||||
for number in line.unwrap().split_whitespace() {
|
||||
print_factors_str(number);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
extern crate uucore;
|
||||
|
||||
use std::fs;
|
||||
use std::io::{stdin, BufRead, BufReader, Result};
|
||||
use std::io::{stdin, Result};
|
||||
#[cfg(any(unix, target_os = "redox"))]
|
||||
use std::os::unix::fs::symlink;
|
||||
#[cfg(windows)]
|
||||
|
@ -303,7 +303,7 @@ fn link(src: &PathBuf, dst: &PathBuf, settings: &Settings) -> Result<()> {
|
|||
|
||||
fn read_yes() -> bool {
|
||||
let mut s = String::new();
|
||||
match BufReader::new(stdin()).read_line(&mut s) {
|
||||
match stdin().read_line(&mut s) {
|
||||
Ok(_) => match s.char_indices().nth(0) {
|
||||
Some((_, x)) => x == 'y' || x == 'Y',
|
||||
_ => false,
|
||||
|
|
|
@ -16,7 +16,7 @@ extern crate uucore;
|
|||
|
||||
use std::fs;
|
||||
use std::env;
|
||||
use std::io::{stdin, BufRead, BufReader, Result};
|
||||
use std::io::{stdin, Result};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
static NAME: &str = "mv";
|
||||
|
@ -374,7 +374,7 @@ fn rename(from: &PathBuf, to: &PathBuf, b: &Behaviour) -> Result<()> {
|
|||
|
||||
fn read_yes() -> bool {
|
||||
let mut s = String::new();
|
||||
match BufReader::new(stdin()).read_line(&mut s) {
|
||||
match stdin().read_line(&mut s) {
|
||||
Ok(_) => match s.chars().nth(0) {
|
||||
Some(x) => x == 'y' || x == 'Y',
|
||||
_ => false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue