use std::convert::TryInto instead of using crate

master
ranfdev 4 years ago committed by Paul Woolcock
parent 83587a10d2
commit d0e257df85
  1. 1
      Cargo.toml
  2. 12
      src/apps.rs
  3. 4
      src/registration.rs

@ -24,7 +24,6 @@ serde_qs = "0.6.0"
url = "2.1.1" url = "2.1.1"
tap-reader = "1" tap-reader = "1"
toml = { version = "0.5.0", optional = true } toml = { version = "0.5.0", optional = true }
try_from = "0.3.2"
tungstenite = "0.11.0" tungstenite = "0.11.0"
[dependencies.chrono] [dependencies.chrono]

@ -1,7 +1,7 @@
use std::borrow::Cow; use std::borrow::Cow;
use serde::Serialize; use serde::Serialize;
use try_from::TryInto; use std::convert::TryInto;
use crate::{ use crate::{
errors::{Error, Result}, errors::{Error, Result},
@ -132,16 +132,8 @@ impl<'a> AppBuilder<'a> {
} }
} }
impl TryInto<App> for App {
type Err = Error;
fn try_into(self) -> Result<App> {
Ok(self)
}
}
impl<'a> TryInto<App> for AppBuilder<'a> { impl<'a> TryInto<App> for AppBuilder<'a> {
type Err = Error; type Error = Error;
fn try_into(self) -> Result<App> { fn try_into(self) -> Result<App> {
Ok(self.build()?) Ok(self.build()?)

@ -2,7 +2,7 @@ use std::borrow::Cow;
use reqwest::blocking::{Client, RequestBuilder, Response}; use reqwest::blocking::{Client, RequestBuilder, Response};
use serde::Deserialize; use serde::Deserialize;
use try_from::TryInto; use std::convert::TryInto;
use crate::{ use crate::{
apps::{App, AppBuilder}, apps::{App, AppBuilder},
@ -125,7 +125,7 @@ impl<'a> Registration<'a> {
/// ``` /// ```
pub fn register<I: TryInto<App>>(&mut self, app: I) -> Result<Registered> pub fn register<I: TryInto<App>>(&mut self, app: I) -> Result<Registered>
where where
Error: From<<I as TryInto<App>>::Err>, Error: From<<I as TryInto<App>>::Error>,
{ {
let app = app.try_into()?; let app = app.try_into()?;
let oauth = self.send_app(&app)?; let oauth = self.send_app(&app)?;

Loading…
Cancel
Save