libextra: Remove unnecessary `@mut`s
This commit is contained in:
parent
c1d6f5ed51
commit
07bbc4133d
|
@ -113,7 +113,8 @@ impl<T: Writer> Terminal<T> {
|
|||
return Err(entry.unwrap_err());
|
||||
}
|
||||
|
||||
let ti = parse(entry.unwrap(), false);
|
||||
let mut file = entry.unwrap();
|
||||
let ti = parse(&mut file, false);
|
||||
if ti.is_err() {
|
||||
return Err(ti.unwrap_err());
|
||||
}
|
||||
|
|
|
@ -11,10 +11,9 @@
|
|||
/// Implement ncurses-compatible database discovery
|
||||
/// Does not support hashed database, only filesystem!
|
||||
|
||||
use std::{os, str};
|
||||
use std::os::getenv;
|
||||
use std::io;
|
||||
use std::io::File;
|
||||
use std::os::getenv;
|
||||
use std::{os, str};
|
||||
|
||||
/// Return path to database entry for `term`
|
||||
pub fn get_dbpath_for_term(term: &str) -> Option<~Path> {
|
||||
|
@ -74,9 +73,14 @@ pub fn get_dbpath_for_term(term: &str) -> Option<~Path> {
|
|||
}
|
||||
|
||||
/// Return open file for `term`
|
||||
pub fn open(term: &str) -> Result<@mut io::Reader, ~str> {
|
||||
pub fn open(term: &str) -> Result<File, ~str> {
|
||||
match get_dbpath_for_term(term) {
|
||||
Some(x) => Ok(@mut File::open(x) as @mut io::Reader),
|
||||
Some(x) => {
|
||||
match File::open(x) {
|
||||
Some(file) => Ok(file),
|
||||
None => Err(~"error opening file"),
|
||||
}
|
||||
}
|
||||
None => Err(format!("could not find terminfo entry for {}", term))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -949,7 +949,8 @@ impl MetricMap {
|
|||
|
||||
/// Write MetricDiff to a file.
|
||||
pub fn save(&self, p: &Path) {
|
||||
self.to_json().to_pretty_writer(@mut File::create(p) as @mut io::Writer);
|
||||
let mut file = File::create(p);
|
||||
self.to_json().to_pretty_writer(&mut file)
|
||||
}
|
||||
|
||||
/// Compare against another MetricMap. Optionally compare all
|
||||
|
|
|
@ -796,8 +796,8 @@ mod test {
|
|||
use serialize::{Encodable, Decodable};
|
||||
|
||||
let u = Uuid::new_v4();
|
||||
let wr = @mut MemWriter::new();
|
||||
u.encode(&mut ebml::writer::Encoder(wr));
|
||||
let mut wr = MemWriter::new();
|
||||
u.encode(&mut ebml::writer::Encoder(&mut wr));
|
||||
let doc = ebml::reader::Doc(wr.inner_ref().as_slice());
|
||||
let u2 = Decodable::decode(&mut ebml::reader::Decoder(doc));
|
||||
assert_eq!(u, u2);
|
||||
|
|
|
@ -173,8 +173,8 @@ impl Database {
|
|||
|
||||
// FIXME #4330: This should have &mut self and should set self.db_dirty to false.
|
||||
fn save(&self) {
|
||||
let f = @mut File::create(&self.db_filename);
|
||||
self.db_cache.to_json().to_pretty_writer(f as @mut io::Writer);
|
||||
let mut f = File::create(&self.db_filename);
|
||||
self.db_cache.to_json().to_pretty_writer(&mut f);
|
||||
}
|
||||
|
||||
fn load(&mut self) {
|
||||
|
@ -184,14 +184,16 @@ impl Database {
|
|||
Err(e) => fail!("Couldn't load workcache database {}: {}",
|
||||
self.db_filename.display(),
|
||||
e.desc),
|
||||
Ok(r) =>
|
||||
match json::from_reader(@mut r.unwrap() as @mut io::Reader) {
|
||||
Ok(r) => {
|
||||
let mut stream = r.unwrap();
|
||||
match json::from_reader(&mut stream) {
|
||||
Err(e) => fail!("Couldn't parse workcache database (from file {}): {}",
|
||||
self.db_filename.display(), e.to_str()),
|
||||
Ok(r) => {
|
||||
let mut decoder = json::Decoder::new(r);
|
||||
self.db_cache = Decodable::decode(&mut decoder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue