Skip to content

Commit

Permalink
bump Rust edition to 2021, update a few creates
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnachlinger committed May 8, 2024
1 parent ac649b2 commit da88754
Show file tree
Hide file tree
Showing 271 changed files with 366 additions and 301 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ license = "{{.}}"
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
{{/licenseInfo}}
edition = "2018"
edition = "2021"
{{#publishRustRegistry}}
publish = ["{{.}}"]
{{/publishRustRegistry}}
Expand Down
24 changes: 11 additions & 13 deletions modules/openapi-generator/src/main/resources/rust/Cargo.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ license = "{{.}}"
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
{{/licenseInfo}}
edition = "2018"
edition = "2021"
{{#publishRustRegistry}}
publish = ["{{.}}"]
{{/publishRustRegistry}}
Expand All @@ -32,14 +32,13 @@ homepage = "{{.}}
{{/homePageUrl}}

[dependencies]
serde = "^1.0"
serde_derive = "^1.0"
serde = { version = "^1.0", features = ["derive"] }
{{#serdeWith}}
serde_with = { version = "^3", default-features = false, features = ["base64", "std", "macros"] }
serde_with = { version = "^3.8", default-features = false, features = ["base64", "std", "macros"] }
{{/serdeWith}}
serde_json = "^1.0"
url = "^2.2"
uuid = { version = "^1.0", features = ["serde", "v4"] }
url = "^2.5"
uuid = { version = "^1.8", features = ["serde", "v4"] }
{{#hyper}}
hyper = { version = "~0.14", features = ["full"] }
hyper-tls = "~0.5"
Expand All @@ -54,16 +53,15 @@ secrecy = "0.8.0"
{{/withAWSV4Signature}}
{{#reqwest}}
{{^supportAsync}}
[dependencies.reqwest]
version = "^0.11"
features = ["json", "blocking", "multipart"]
reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] }
{{#supportMiddleware}}
reqwest-middleware= { version = "^0.3", features = ["json", "blocking", "multipart"] }
{{/supportMiddleware}}
{{/supportAsync}}
{{#supportAsync}}
reqwest = { version = "^0.12", features = ["json", "multipart"] }
{{#supportMiddleware}}
reqwest-middleware = "0.2.0"
reqwest-middleware= { version = "^0.3", features = ["json", "multipart"] }
{{/supportMiddleware}}
[dependencies.reqwest]
version = "^0.11"
features = ["json", "multipart"]
{{/supportAsync}}
{{/reqwest}}
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ impl From<(hyper::StatusCode, hyper::body::Body)> for Error {

impl From<http::Error> for Error {
fn from(e: http::Error) -> Self {
return Error::Http(e)
Error::Http(e)
}
}

impl From<hyper::Error> for Error {
fn from(e: hyper::Error) -> Self {
return Error::Hyper(e)
Error::Hyper(e)
}
}

impl From<serde_json::Error> for Error {
fn from(e: serde_json::Error) -> Self {
return Error::Serde(e)
Error::Serde(e)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#![allow(unused_imports)]
#![allow(clippy::too_many_arguments)]

#[macro_use]
extern crate serde_derive;

extern crate serde;
extern crate serde_json;
extern crate url;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{>partial_header}}
use crate::models;
use serde::{Deserialize, Serialize};
{{#models}}
{{#model}}
{{^isEnum}}{{#vendorExtensions.x-rust-has-byte-array}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{>partial_header}}

use reqwest;

use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};

Expand Down Expand Up @@ -174,7 +174,7 @@ pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration:
{{/bodyParams}}
{{/hasBodyParam}}
{{^hasBodyParam}}
&"",
"",
{{/hasBodyParam}}
) {
Ok(new_headers) => new_headers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl AWSv4Key {
value.to_str().expect("header value should be a string").to_string()));
}
}
return Ok(additional_headers);
Ok(additional_headers)
}
}
{{/withAWSV4Signature}}
Expand Down
1 change: 1 addition & 0 deletions samples/client/others/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[workspace]
members = ["hyper/*", "reqwest/*", "reqwest-regression-16119"]
resolver = "2"
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ authors = ["OpenAPI Generator team and contributors"]
description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)"
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
edition = "2018"
edition = "2021"

[dependencies]
serde = "^1.0"
serde_derive = "^1.0"
serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
url = "^2.2"
uuid = { version = "^1.0", features = ["serde", "v4"] }
url = "^2.5"
uuid = { version = "^1.8", features = ["serde", "v4"] }
hyper = { version = "~0.14", features = ["full"] }
hyper-tls = "~0.5"
http = "~0.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ impl From<(hyper::StatusCode, hyper::body::Body)> for Error {

impl From<http::Error> for Error {
fn from(e: http::Error) -> Self {
return Error::Http(e)
Error::Http(e)
}
}

impl From<hyper::Error> for Error {
fn from(e: hyper::Error) -> Self {
return Error::Hyper(e)
Error::Hyper(e)
}
}

impl From<serde_json::Error> for Error {
fn from(e: serde_json::Error) -> Self {
return Error::Serde(e)
Error::Serde(e)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#![allow(unused_imports)]
#![allow(clippy::too_many_arguments)]

#[macro_use]
extern crate serde_derive;

extern crate serde;
extern crate serde_json;
extern crate url;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

use crate::models;
use serde::{Deserialize, Serialize};

///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
Expand Down
9 changes: 4 additions & 5 deletions samples/client/others/rust/hyper/composed-oneof/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ authors = ["OpenAPI Generator team and contributors"]
description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)"
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
edition = "2018"
edition = "2021"

[dependencies]
serde = "^1.0"
serde_derive = "^1.0"
serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
url = "^2.2"
uuid = { version = "^1.0", features = ["serde", "v4"] }
url = "^2.5"
uuid = { version = "^1.8", features = ["serde", "v4"] }
hyper = { version = "~0.14", features = ["full"] }
hyper-tls = "~0.5"
http = "~0.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ impl From<(hyper::StatusCode, hyper::body::Body)> for Error {

impl From<http::Error> for Error {
fn from(e: http::Error) -> Self {
return Error::Http(e)
Error::Http(e)
}
}

impl From<hyper::Error> for Error {
fn from(e: hyper::Error) -> Self {
return Error::Hyper(e)
Error::Hyper(e)
}
}

impl From<serde_json::Error> for Error {
fn from(e: serde_json::Error) -> Self {
return Error::Serde(e)
Error::Serde(e)
}
}

Expand Down
3 changes: 0 additions & 3 deletions samples/client/others/rust/hyper/composed-oneof/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#![allow(unused_imports)]
#![allow(clippy::too_many_arguments)]

#[macro_use]
extern crate serde_derive;

extern crate serde;
extern crate serde_json;
extern crate url;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "realtype")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "realtype")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "realtype")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "realtype")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ObjA {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ObjB {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ObjC {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ObjD {
Expand Down
9 changes: 4 additions & 5 deletions samples/client/others/rust/hyper/emptyObject/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ authors = ["OpenAPI Generator team and contributors"]
description = "Ensure rust supports empty objects using serde::Value"
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
edition = "2018"
edition = "2021"

[dependencies]
serde = "^1.0"
serde_derive = "^1.0"
serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
url = "^2.2"
uuid = { version = "^1.0", features = ["serde", "v4"] }
url = "^2.5"
uuid = { version = "^1.8", features = ["serde", "v4"] }
hyper = { version = "~0.14", features = ["full"] }
hyper-tls = "~0.5"
http = "~0.2"
Expand Down
6 changes: 3 additions & 3 deletions samples/client/others/rust/hyper/emptyObject/src/apis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ impl From<(hyper::StatusCode, hyper::body::Body)> for Error {

impl From<http::Error> for Error {
fn from(e: http::Error) -> Self {
return Error::Http(e)
Error::Http(e)
}
}

impl From<hyper::Error> for Error {
fn from(e: hyper::Error) -> Self {
return Error::Hyper(e)
Error::Hyper(e)
}
}

impl From<serde_json::Error> for Error {
fn from(e: serde_json::Error) -> Self {
return Error::Serde(e)
Error::Serde(e)
}
}

Expand Down
3 changes: 0 additions & 3 deletions samples/client/others/rust/hyper/emptyObject/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#![allow(unused_imports)]
#![allow(clippy::too_many_arguments)]

#[macro_use]
extern crate serde_derive;

extern crate serde;
extern crate serde_json;
extern crate url;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct EmptyObject {
Expand Down
9 changes: 4 additions & 5 deletions samples/client/others/rust/hyper/oneOf-array-map/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ authors = ["OpenAPI Generator team and contributors"]
description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)"
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
edition = "2018"
edition = "2021"

[dependencies]
serde = "^1.0"
serde_derive = "^1.0"
serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
url = "^2.2"
uuid = { version = "^1.0", features = ["serde", "v4"] }
url = "^2.5"
uuid = { version = "^1.8", features = ["serde", "v4"] }
hyper = { version = "~0.14", features = ["full"] }
hyper-tls = "~0.5"
http = "~0.2"
Expand Down
Loading

0 comments on commit da88754

Please sign in to comment.