Преглед на файлове

Import directly from std::fs; include Write traits

Samuel W. Flint преди 3 години
родител
ревизия
92bb382c34
променени са 1 файла, в които са добавени 6 реда и са изтрити 2 реда
  1. 6 2
      src/config.rs

+ 6 - 2
src/config.rs

@@ -1,7 +1,11 @@
 use serde::{Deserialize, Serialize};
 use std::collections::HashMap;
 use std::path::PathBuf;
-use std::fs;
+use std::fs::{
+    File,
+    read_to_string
+};
+use std::io::Write;
 
 #[derive(Serialize, Deserialize)]
 pub struct Config {
@@ -79,7 +83,7 @@ pub fn find_config_file(original: Option<&str>) -> PathBuf {
 }
 
 pub fn read_configuration_file(filename: PathBuf) -> Config {
-    let text = fs::read_to_string(filename);
+    let text = read_to_string(filename);
     match text {
         Err(_) => {
             let mut config = Config {