Merge pull request #92 from c410-f3r/compilation-errors

Fix compilation errors
This commit is contained in:
Sunli 2020-05-17 09:01:09 +08:00 committed by GitHub
commit a578f1a22f
3 changed files with 11 additions and 5 deletions

View File

@ -17,6 +17,8 @@ jobs:
run: cargo fmt --all -- --check run: cargo fmt --all -- --check
- name: Check with clippy - name: Check with clippy
run: cargo clippy --all run: cargo clippy --all
- name: Build without features
run: cargo build --no-default-features
- name: Build - name: Build
run: cargo build --all --verbose run: cargo build --all --verbose
- name: Run tests - name: Run tests

View File

@ -1,10 +1,10 @@
use crate::{InputValueError, InputValueResult, Result, ScalarType, Value}; use crate::{InputValueError, InputValueResult, Result, ScalarType, Value};
use async_graphql_derive::Scalar; use async_graphql_derive::Scalar;
#[cfg(feature = "bson")]
use bson::oid::{self, ObjectId}; use bson::oid::{self, ObjectId};
use std::convert::TryFrom; use std::convert::TryFrom;
use std::num::ParseIntError; use std::num::ParseIntError;
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};
use uuid::Uuid;
/// ID scalar /// ID scalar
/// ///
@ -49,14 +49,16 @@ impl TryFrom<ID> for usize {
} }
} }
impl TryFrom<ID> for Uuid { #[cfg(feature = "uuid")]
impl TryFrom<ID> for uuid::Uuid {
type Error = uuid::Error; type Error = uuid::Error;
fn try_from(id: ID) -> std::result::Result<Self, Self::Error> { fn try_from(id: ID) -> std::result::Result<Self, Self::Error> {
Uuid::parse_str(&id.0) uuid::Uuid::parse_str(&id.0)
} }
} }
#[cfg(feature = "bson")]
impl TryFrom<ID> for ObjectId { impl TryFrom<ID> for ObjectId {
type Error = oid::Error; type Error = oid::Error;

View File

@ -1,6 +1,5 @@
mod any; mod any;
mod bool; mod bool;
mod chrono_tz;
mod datetime; mod datetime;
mod floats; mod floats;
mod id; mod id;
@ -9,10 +8,13 @@ mod json;
mod naive_date; mod naive_date;
mod naive_time; mod naive_time;
mod string; mod string;
mod url;
#[cfg(feature = "bson")] #[cfg(feature = "bson")]
mod bson; mod bson;
#[cfg(feature = "chrono_tz")]
mod chrono_tz;
#[cfg(feature = "uuid")]
mod url;
#[cfg(feature = "uuid")] #[cfg(feature = "uuid")]
mod uuid; mod uuid;