Change Mastodon::from_data to just Mastodon::from

This commit is contained in:
Paul Woolcock
2018-08-22 06:48:56 -04:00
parent 1847160369
commit cc083e335e
4 changed files with 18 additions and 15 deletions
+3 -2
View File
@@ -1,7 +1,7 @@
extern crate elefren;
extern crate toml;
pub use self::elefren::MastodonClient;
pub use self::elefren::{Data, MastodonClient};
use std::{
error::Error,
@@ -28,7 +28,8 @@ fn main() -> Result<(), Box<Error>> {
#[allow(dead_code)]
pub fn get_mastodon_data() -> Result<Mastodon, Box<Error>> {
if let Ok(config) = fs::read_to_string("mastodon-data.toml") {
Ok(Mastodon::from_data(toml::from_str(&config)?))
let data: Data = toml::from_str(&config)?;
Ok(Mastodon::from(data))
} else {
register()
}