From 5c76cd61f57c59e3ce4a4dbd373f4235c15291e0 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Sat, 12 May 2018 12:56:30 +0200 Subject: [PATCH] clean: Remove useless `read_to_vec` function --- src/bin/raptor.rs | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/bin/raptor.rs b/src/bin/raptor.rs index 8862d89bd..2ed9dc56d 100644 --- a/src/bin/raptor.rs +++ b/src/bin/raptor.rs @@ -10,7 +10,7 @@ extern crate url; use std::io; use std::path::Path; -use std::fs::File; +use std::fs::{self, File}; use std::io::{Read, BufReader}; use fst::Streamer; @@ -100,24 +100,14 @@ impl<'a> Service for MainService<'a> { } } -fn read_to_vec>(path: P) -> io::Result> { - let file = File::open(path)?; - let mut file = BufReader::new(file); - - let mut vec = Vec::new(); - file.read_to_end(&mut vec)?; - - Ok(vec) -} - fn main() { drop(env_logger::init()); // initialize all static variables unsafe { MAP = { - let map = read_to_vec("map.fst").unwrap(); - let values = read_to_vec("values.vecs").unwrap(); + let map = fs::read("map.fst").unwrap(); + let values = fs::read("values.vecs").unwrap(); Some(FstMap::from_bytes(map, &values).unwrap()) };