Verified Commit f2728986 authored by Grokafar's avatar Grokafar
Browse files

Migrate to rust edition 2018

parent e5014d95
......@@ -11,6 +11,7 @@ documentation = "https://docs.rs/gitlab/0.1208.1"
readme = "README.md"
keywords = ["gitlab", "api"]
categories = ["web-programming", "api-bindings"]
edition = "2018"
[dependencies]
derive_builder = "~0.9"
......
......@@ -9,20 +9,19 @@ use std::any;
use std::borrow::Borrow;
use std::fmt::{self, Debug, Display};
use crates::graphql_client::{GraphQLQuery, QueryBody, Response};
use crates::itertools::Itertools;
use crates::percent_encoding::{utf8_percent_encode, AsciiSet, PercentEncode, CONTROLS};
use crates::reqwest::blocking::{Client, RequestBuilder};
use crates::reqwest::header::{self, HeaderValue};
use crates::serde::de::Error as SerdeError;
use crates::serde::de::{DeserializeOwned, Unexpected};
use crates::serde::ser::Serialize;
use crates::serde::{Deserialize, Deserializer, Serializer};
use crates::serde_json;
use crates::thiserror::Error;
use crates::url::{self, Url};
use types::*;
use graphql_client::{GraphQLQuery, QueryBody, Response};
use itertools::Itertools;
use percent_encoding::{utf8_percent_encode, AsciiSet, PercentEncode, CONTROLS};
use reqwest::blocking::{Client, RequestBuilder};
use reqwest::header::{self, HeaderValue};
use reqwest::Url;
use serde::de::Error as SerdeError;
use serde::de::{DeserializeOwned, Unexpected};
use serde::ser::Serialize;
use serde::{Deserialize, Deserializer, Serializer};
use thiserror::Error;
use crate::types::*;
const PATH_SEGMENT_ENCODE_SET: &AsciiSet = &CONTROLS
.add(b' ')
......@@ -1522,7 +1521,7 @@ impl Gitlab {
ref_: ObjectId,
variables: &[PipelineVariable],
) -> GitlabResult<Pipeline> {
use crates::serde::Serialize;
use serde::Serialize;
#[derive(Debug, Serialize)]
struct CreatePipelineParams<'a> {
ref_: ObjectId,
......
......@@ -11,12 +11,12 @@
//! Gitlab does not have consistent structures for its hooks, so they often change from
//! version to version.
use crates::serde::de::{Error, Unexpected};
use crates::serde::{Deserialize, Deserializer};
use crates::serde_json::{self, Value};
use serde::de::{Error, Unexpected};
use serde::{Deserialize, Deserializer};
use serde_json::{self, Value};
use systemhooks::SystemHook;
use webhooks::WebHook;
use crate::systemhooks::SystemHook;
use crate::webhooks::WebHook;
/// A deserializable structure for all Gitlab hooks.
#[derive(Debug, Clone)]
......
......@@ -15,23 +15,6 @@ extern crate derive_builder;
#[macro_use]
extern crate log;
mod crates {
// public
pub extern crate chrono;
pub extern crate graphql_client;
pub extern crate serde;
pub extern crate serde_json;
// private
pub extern crate itertools;
pub extern crate log;
pub extern crate percent_encoding;
pub extern crate reqwest;
// pub extern crate rustversion;
pub extern crate thiserror;
pub extern crate url;
}
#[macro_use]
mod macros;
mod gitlab;
......@@ -41,13 +24,13 @@ pub mod systemhooks;
pub mod types;
pub mod webhooks;
pub use gitlab::CommitStatusInfo;
pub use gitlab::Gitlab;
pub use gitlab::GitlabBuilder;
pub use gitlab::GitlabError;
pub use gitlab::MergeRequestStateFilter;
pub use gitlab::TokenError;
pub use types::*;
pub use crate::gitlab::CommitStatusInfo;
pub use crate::gitlab::Gitlab;
pub use crate::gitlab::GitlabBuilder;
pub use crate::gitlab::GitlabError;
pub use crate::gitlab::MergeRequestStateFilter;
pub use crate::gitlab::TokenError;
pub use crate::types::*;
#[cfg(test)]
mod test;
......@@ -12,13 +12,13 @@
//! Gitlab does not have consistent structures for its hooks, so they often change from
//! version to version.
use crates::chrono::{DateTime, Utc};
use crates::serde::de::{Error, Unexpected};
use crates::serde::{Deserialize, Deserializer, Serialize, Serializer};
use crates::serde_json::{self, Value};
use chrono::{DateTime, Utc};
use serde::de::{Error, Unexpected};
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde_json::{self, Value};
use types::{AccessLevel, GroupId, ObjectId, ProjectId, SshKeyId, UserId};
use webhooks::{CommitHookAttrs, ProjectHookAttrs};
use crate::types::{AccessLevel, GroupId, ObjectId, ProjectId, SshKeyId, UserId};
use crate::webhooks::{CommitHookAttrs, ProjectHookAttrs};
/// Events which occur at the project level.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
......
......@@ -6,12 +6,12 @@
use std::fs::File;
use crates::chrono::{DateTime, NaiveDate, TimeZone, Utc};
use crates::itertools;
use crates::serde::de::DeserializeOwned;
use crates::serde_json::{from_reader, json};
use chrono::{DateTime, NaiveDate, TimeZone, Utc};
use itertools;
use serde::de::DeserializeOwned;
use serde_json::{from_reader, json};
use types::*;
use crate::types::*;
fn check_user_brad_king(user: &UserBasic) {
assert_eq!(user.username, "brad.king");
......
......@@ -4,10 +4,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use crates::chrono::{TimeZone, Utc};
use crates::serde_json::from_str;
use chrono::{TimeZone, Utc};
use serde_json::from_str;
use webhooks::*;
use crate::webhooks::*;
#[test]
fn test_hookdate_deserialize() {
......
......@@ -15,11 +15,11 @@
use std::fmt::{self, Display, Formatter};
use std::str::FromStr;
use crates::chrono::{DateTime, NaiveDate, Utc};
use crates::reqwest::Url;
use crates::serde::de::{DeserializeOwned, Error, Unexpected};
use crates::serde::{Deserialize, Deserializer, Serialize, Serializer};
use crates::serde_json::{self, Value};
use chrono::{DateTime, NaiveDate, Utc};
use reqwest::Url;
use serde::de::{DeserializeOwned, Error, Unexpected};
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde_json::{self, Value};
// This is only used in internal API calls.
//#[derive(Serialize, Deserialize, Debug, Clone)]
......
......@@ -11,12 +11,12 @@
//! Gitlab does not have consistent structures for its hooks, so they often change from
//! version to version.
use crates::chrono::{DateTime, NaiveDate, TimeZone, Utc};
use crates::serde::de::{Error, Unexpected};
use crates::serde::{Deserialize, Deserializer, Serialize, Serializer};
use crates::serde_json::{self, Value};
use chrono::{DateTime, NaiveDate, TimeZone, Utc};
use serde::de::{Error, Unexpected};
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde_json::{self, Value};
use types::{
use crate::types::{
IssueId, IssueInternalId, IssueState, JobId, MergeRequestId, MergeRequestInternalId,
MergeRequestState, MergeStatus, MilestoneId, NoteId, NoteType, NoteableId, ObjectId, ProjectId,
SnippetId, UserId,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment