Skip to content
This repository has been archived by the owner on Mar 23, 2020. It is now read-only.

Commit

Permalink
Updated code to be 2018 edition compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
XAMPPRocky committed May 19, 2019
1 parent 9cb9cd8 commit 4bf00ae
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 21 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[package]
name = "mammut"
version = "0.12.0"
edition = "2018"

description = "A wrapper around the Mastodon API."
authors = ["Aaron Power <theaaronepower@gmail.com>"]
Expand All @@ -18,6 +19,7 @@ serde = "1"
serde_derive = "1"
serde_json = "1"
url = "1"
log = "0.4.6"

[dependencies.chrono]
version = "0.4"
Expand Down
8 changes: 5 additions & 3 deletions src/entities/account.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
//! A module containing everything relating to a account returned from the api.

use std::path::Path;

use chrono::prelude::*;
use reqwest::multipart::Form;
use ::Result;
use std::path::Path;

use crate::Result;

/// A struct representing an Account.
#[derive(Debug, Clone, Deserialize)]
Expand Down Expand Up @@ -50,7 +52,7 @@ pub struct Account {
/// An extra object given from `verify_credentials` giving defaults about a user
#[derive(Debug, Clone, Deserialize)]
pub struct Source {
privacy: ::status_builder::Visibility,
privacy: crate::status_builder::Visibility,
sensitive: bool,
note: String,
}
Expand Down
3 changes: 2 additions & 1 deletion src/entities/itemsiter.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use page::Page;
use serde::Deserialize;

use crate::page::Page;

/// Abstracts away the `next_page` logic into a single stream of items
///
/// ```no_run
Expand Down
2 changes: 1 addition & 1 deletion src/entities/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use chrono::prelude::*;
use super::prelude::*;
use status_builder::Visibility;
use crate::status_builder::Visibility;

/// A status from the instance.
#[derive(Debug, Clone, Deserialize)]
Expand Down
10 changes: 1 addition & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
//!
//! ```no_run
//! # extern crate mammut;
//! # fn main() {
//! # try().unwrap();
//! # }
//! # fn try() -> mammut::Result<()> {
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! use mammut::Registration;
//! use mammut::apps::{AppBuilder, Scopes};
//!
Expand Down Expand Up @@ -38,11 +35,6 @@
#[macro_use] extern crate serde_derive;
#[macro_use] extern crate doc_comment;
#[macro_use] extern crate serde_json as json;
extern crate hyperx;
extern crate chrono;
extern crate reqwest;
extern crate serde;
extern crate url;

/// Registering your App
pub mod apps;
Expand Down
5 changes: 3 additions & 2 deletions src/page.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use super::{Mastodon, Result, deserialise};
use reqwest::Response;
use reqwest::header::LINK;
use hyperx::header::{Header, Link, RelationType};
use serde::Deserialize;
use url::Url;
use entities::itemsiter::ItemsIter;

use crate::entities::itemsiter::ItemsIter;
use super::{Mastodon, Result, deserialise};

pub struct Page<'a, T: for<'de> Deserialize<'de>> {
mastodon: &'a Mastodon,
Expand Down
7 changes: 2 additions & 5 deletions src/registration.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use reqwest::Client;

use super::{Error, Mastodon, Result};
use apps::{AppBuilder, Scopes};
use crate::apps::{AppBuilder, Scopes};

/// Handles registering your mastodon app to your instance. It is recommended
/// you cache your data struct to avoid registering on every run.
Expand Down Expand Up @@ -48,10 +48,7 @@ impl Registration {
///
/// ```no_run
/// # extern crate mammut;
/// # fn main() {
/// # try().unwrap();
/// # }
/// # fn try() -> mammut::Result<()> {
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
/// use mammut::Registration;
/// use mammut::apps::{AppBuilder, Scopes};
///
Expand Down

0 comments on commit 4bf00ae

Please sign in to comment.