Dogfood feature(file_buffered) · qinheping/verify-rust-std@963cefb (original) (raw)

3 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -517,7 +517,7 @@ mod cgroups {
517 517 use crate::borrow::Cow;
518 518 use crate::ffi::OsString;
519 519 use crate::fs::{File, exists};
520 -use crate::io::{BufRead, BufReader, Read};
520 +use crate::io::{BufRead, Read};
521 521 use crate::os::unix::ffi::OsStringExt;
522 522 use crate::path::{Path, PathBuf};
523 523 use crate::str::from_utf8;
@@ -690,7 +690,7 @@ mod cgroups {
690 690 /// If the cgroupfs is a bind mount then `group_path` is adjusted to skip
691 691 /// over the already-included prefix
692 692 fn find_mountpoint(group_path: &Path) -> Option<(Cow<'static, str>, &Path)> {
693 -let mut reader = BufReader::new(File::open("/proc/self/mountinfo").ok()?);
693 +let mut reader = File::open_buffered("/proc/self/mountinfo").ok()?;
694 694 let mut line = String::with_capacity(256);
695 695 loop {
696 696 line.clear();
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@
18 18 #![doc(test(attr(deny(warnings))))]
19 19 #![doc(rust_logo)]
20 20 #![feature(rustdoc_internals)]
21 +#![feature(file_buffered)]
21 22 #![feature(internal_output_capture)]
22 23 #![feature(staged_api)]
23 24 #![feature(process_exitcode_internals)]
Original file line number Diff line number Diff line change
@@ -3,9 +3,8 @@
3 3 use std::collections::HashMap;
4 4 use std::fs::File;
5 5 use std::io::prelude::*;
6 -use std::io::{self, BufReader};
7 6 use std::path::Path;
8 -use std::{env, error, fmt};
7 +use std::{env, error, fmt, io};
9 8
10 9 use parm::{Param, Variables, expand};
11 10 use parser::compiled::{msys_terminfo, parse};
@@ -102,8 +101,7 @@ impl TermInfo {
102 101 }
103 102 // Keep the metadata small
104 103 fn _from_path(path: &Path) -> Result<TermInfo, Error> {
105 -let file = File::open(path).map_err(Error::IoError)?;
106 -let mut reader = BufReader::new(file);
104 +let mut reader = File::open_buffered(path).map_err(Error::IoError)?;
107 105 parse(&mut reader, false).map_err(Error::MalformedTerminfo)
108 106 }
109 107 }