mirror of
https://github.com/crate-ci/typos.git
synced 2024-12-23 08:02:15 -05:00
refactor(config): Simplify
This commit is contained in:
parent
60dbf0a254
commit
b5827004a2
1 changed files with 1 additions and 4 deletions
|
@ -1,5 +1,4 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::io::Read;
|
|
||||||
|
|
||||||
pub trait ConfigSource {
|
pub trait ConfigSource {
|
||||||
fn walk(&self) -> Option<&dyn WalkSource> {
|
fn walk(&self) -> Option<&dyn WalkSource> {
|
||||||
|
@ -107,9 +106,7 @@ pub struct Config {
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
pub fn from_file(path: &std::path::Path) -> Result<Self, anyhow::Error> {
|
pub fn from_file(path: &std::path::Path) -> Result<Self, anyhow::Error> {
|
||||||
let mut file = std::fs::File::open(path)?;
|
let s = std::fs::read_to_string(path)?;
|
||||||
let mut s = String::new();
|
|
||||||
file.read_to_string(&mut s)?;
|
|
||||||
Self::from_toml(&s)
|
Self::from_toml(&s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue