Run cargo fmt

This commit is contained in:
Graham Esau 2019-12-29 22:09:54 +00:00
parent 98f981634c
commit 58cc7fac25
22 changed files with 57 additions and 74 deletions

View file

@ -24,9 +24,7 @@ pub struct MyStruct {
#[derive(JsonSchema)]
pub enum MyEnum {
StringNewType(String),
StructVariant {
floats: Vec<f32>,
}
StructVariant { floats: Vec<f32> },
}
fn main() {
@ -133,9 +131,7 @@ pub struct MyStruct {
#[serde(untagged)]
pub enum MyEnum {
StringNewType(String),
StructVariant {
floats: Vec<f32>,
}
StructVariant { floats: Vec<f32> },
}
fn main() {

View file

@ -38,7 +38,9 @@ mod as_string {
D: Deserializer<'de>,
{
let string = String::deserialize(deserializer)?;
string.parse().map_err(|_| D::Error::custom("Input was not valid"))
string
.parse()
.map_err(|_| D::Error::custom("Input was not valid"))
}
}

View file

@ -24,7 +24,7 @@ pub enum MyEnum {
StructVariant {
/// The floats themselves
floats: Vec<f32>,
}
},
}
fn main() {

View file

@ -10,9 +10,7 @@ pub struct MyStruct {
#[derive(JsonSchema)]
pub enum MyEnum {
StringNewType(String),
StructVariant {
floats: Vec<f32>,
}
StructVariant { floats: Vec<f32> },
}
fn main() {

View file

@ -16,9 +16,7 @@ pub struct MyStruct {
#[schemars(untagged)]
pub enum MyEnum {
StringNewType(String),
StructVariant {
floats: Vec<f32>,
}
StructVariant { floats: Vec<f32> },
}
fn main() {

View file

@ -15,9 +15,7 @@ pub struct MyStruct {
#[serde(untagged)]
pub enum MyEnum {
StringNewType(String),
StructVariant {
floats: Vec<f32>,
}
StructVariant { floats: Vec<f32> },
}
fn main() {

View file

@ -38,7 +38,9 @@ mod as_string {
D: Deserializer<'de>,
{
let string = String::deserialize(deserializer)?;
string.parse().map_err(|_| D::Error::custom("Input was not valid"))
string
.parse()
.map_err(|_| D::Error::custom("Input was not valid"))
}
}

View file

@ -24,7 +24,7 @@ pub enum MyEnum {
StructVariant {
/// The floats themselves
floats: Vec<f32>,
}
},
}
fn main() {

View file

@ -10,9 +10,7 @@ pub struct MyStruct {
#[derive(JsonSchema)]
pub enum MyEnum {
StringNewType(String),
StructVariant {
floats: Vec<f32>,
}
StructVariant { floats: Vec<f32> },
}
fn main() {

View file

@ -16,9 +16,7 @@ pub struct MyStruct {
#[schemars(untagged)]
pub enum MyEnum {
StringNewType(String),
StructVariant {
floats: Vec<f32>,
}
StructVariant { floats: Vec<f32> },
}
fn main() {

View file

@ -15,9 +15,7 @@ pub struct MyStruct {
#[serde(untagged)]
pub enum MyEnum {
StringNewType(String),
StructVariant {
floats: Vec<f32>,
}
StructVariant { floats: Vec<f32> },
}
fn main() {

View file

@ -15,7 +15,11 @@ where
no_ref_schema!();
fn schema_name() -> String {
format!("Array_up_to_size_{}_of_{}", A::CAPACITY, A::Item::schema_name())
format!(
"Array_up_to_size_{}_of_{}",
A::CAPACITY,
A::Item::schema_name()
)
}
fn json_schema(gen: &mut SchemaGenerator) -> Schema {

View file

@ -69,8 +69,7 @@ mod tests {
#[test]
fn schema_for_map_any_value_no_bool_schema() {
let settings =
SchemaSettings::default().with(|s| s.bool_schemas = BoolSchemas::Disabled);
let settings = SchemaSettings::default().with(|s| s.bool_schemas = BoolSchemas::Disabled);
let schema = custom_schema_object_for::<BTreeMap<String, serde_json::Value>>(settings);
assert_eq!(
schema.instance_type,

View file

@ -32,22 +32,18 @@ macro_rules! forward_impl {
}
mod array;
#[cfg(feature = "arrayvec")]
mod arrayvec;
#[cfg(std_atomic)]
mod atomic;
#[cfg(feature = "chrono")]
mod chrono;
#[cfg(feature = "indexmap")]
mod indexmap;
mod core;
#[cfg(feature = "either")]
mod either;
#[cfg(feature = "uuid")]
mod uuid;
#[cfg(feature = "smallvec")]
mod smallvec;
#[cfg(feature = "arrayvec")]
mod arrayvec;
mod core;
mod ffi;
#[cfg(feature = "indexmap")]
mod indexmap;
mod maps;
#[cfg(num_nonzero_signed)]
mod nonzero_signed;
@ -55,6 +51,10 @@ mod nonzero_unsigned;
mod primitives;
mod sequences;
mod serdejson;
#[cfg(feature = "smallvec")]
mod smallvec;
mod time;
mod tuple;
#[cfg(feature = "uuid")]
mod uuid;
mod wrapper;

View file

@ -18,9 +18,7 @@ pub struct MyStruct {
#[derive(JsonSchema)]
pub enum MyEnum {
StringNewType(String),
StructVariant {
floats: Vec<f32>,
}
StructVariant { floats: Vec<f32> },
}
fn main() {
@ -127,9 +125,7 @@ pub struct MyStruct {
#[serde(untagged)]
pub enum MyEnum {
StringNewType(String),
StructVariant {
floats: Vec<f32>,
}
StructVariant { floats: Vec<f32> },
}
fn main() {

View file

@ -4,10 +4,10 @@ use util::*;
#[test]
fn arrayvec() -> TestResult {
test_default_generated_schema::<ArrayVec::<[i32; 16]>>("arrayvec")
test_default_generated_schema::<ArrayVec<[i32; 16]>>("arrayvec")
}
#[test]
fn arrayvec_string() -> TestResult {
test_default_generated_schema::<ArrayString::<[u8; 16]>>("arrayvec_string")
test_default_generated_schema::<ArrayString<[u8; 16]>>("arrayvec_string")
}

View file

@ -1,9 +1,9 @@
mod util;
use schemars::JsonSchema;
use serde::{Serialize};
use util::*;
use serde::Serialize;
use std::collections::{HashMap, HashSet};
use util::*;
enum Or<A, B> {
#[allow(dead_code)]

View file

@ -1,6 +1,6 @@
mod util;
use uuid::Uuid;
use util::*;
use uuid::Uuid;
#[test]
fn uuid() -> TestResult {

View file

@ -135,7 +135,7 @@ fn schema_for_enum(variants: &[Variant], cattrs: &serde_attr::Container) -> Toke
}
fn schema_for_external_tagged_enum<'a>(
variants: impl Iterator<Item = &'a Variant<'a>>
variants: impl Iterator<Item = &'a Variant<'a>>,
) -> TokenStream {
let (unit_variants, complex_variants): (Vec<_>, Vec<_>) =
variants.partition(|v| is_unit_variant(v));
@ -241,9 +241,7 @@ fn schema_for_internal_tagged_enum<'a>(
})
}
fn schema_for_untagged_enum<'a>(
variants: impl Iterator<Item = &'a Variant<'a>>
) -> TokenStream {
fn schema_for_untagged_enum<'a>(variants: impl Iterator<Item = &'a Variant<'a>>) -> TokenStream {
let schemas = variants.map(|variant| {
let schema_expr = schema_for_untagged_enum_variant(variant);
set_metadata_on_schema_from_docs(schema_expr, &variant.original.attrs)
@ -257,9 +255,7 @@ fn schema_for_untagged_enum<'a>(
})
}
fn schema_for_untagged_enum_variant(
variant: &Variant
) -> TokenStream {
fn schema_for_untagged_enum_variant(variant: &Variant) -> TokenStream {
match variant.style {
Style::Unit => schema_for_unit_struct(),
Style::Newtype => schema_for_newtype_struct(&variant.fields[0]),