Rust rustfmt
This commit is contained in:
parent
1c47af475f
commit
a85f0fc7bc
4 changed files with 10 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
||||||
use crate::_alloc_prelude::*;
|
|
||||||
use crate::SchemaGenerator;
|
use crate::SchemaGenerator;
|
||||||
|
use crate::_alloc_prelude::*;
|
||||||
use crate::{json_schema, JsonSchema, Schema};
|
use crate::{json_schema, JsonSchema, Schema};
|
||||||
use alloc::borrow::Cow;
|
use alloc::borrow::Cow;
|
||||||
use either1::Either;
|
use either1::Either;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::_alloc_prelude::*;
|
|
||||||
use crate::SchemaGenerator;
|
use crate::SchemaGenerator;
|
||||||
|
use crate::_alloc_prelude::*;
|
||||||
use crate::{json_schema, JsonSchema, Schema};
|
use crate::{json_schema, JsonSchema, Schema};
|
||||||
use alloc::borrow::Cow;
|
use alloc::borrow::Cow;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::_alloc_prelude::*;
|
|
||||||
use crate::SchemaGenerator;
|
use crate::SchemaGenerator;
|
||||||
|
use crate::_alloc_prelude::*;
|
||||||
use crate::{json_schema, JsonSchema, Schema};
|
use crate::{json_schema, JsonSchema, Schema};
|
||||||
use alloc::borrow::Cow;
|
use alloc::borrow::Cow;
|
||||||
use alloc::collections::BTreeMap;
|
use alloc::collections::BTreeMap;
|
||||||
|
|
|
@ -36,7 +36,9 @@ impl Format {
|
||||||
match s {
|
match s {
|
||||||
"email" => Format::Email,
|
"email" => Format::Email,
|
||||||
"url" => Format::Uri,
|
"url" => Format::Uri,
|
||||||
_ => panic!("Invalid format attr string `{s}`. This is a bug in schemars, please raise an issue!"),
|
_ => {
|
||||||
|
panic!("Invalid format attr string `{s}`. This is a bug in schemars, please raise an issue!")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,7 +84,7 @@ impl ValidationAttrs {
|
||||||
if let Some(format) = &self.format {
|
if let Some(format) = &self.format {
|
||||||
let f = format.schema_str();
|
let f = format.schema_str();
|
||||||
mutators.push(quote! {
|
mutators.push(quote! {
|
||||||
(#mut_ref_schema).ensure_object().insert("format".into(), #f.into());
|
(#mut_ref_schema).ensure_object().insert("format".into(), #f.into());
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -156,7 +158,9 @@ impl ValidationAttrs {
|
||||||
(_, Some(_), _) => cx.mutual_exclusive_error(&meta, "contains"),
|
(_, Some(_), _) => cx.mutual_exclusive_error(&meta, "contains"),
|
||||||
(None, None, "schemars") => self.regex = parse_schemars_regex(meta, cx).ok(),
|
(None, None, "schemars") => self.regex = parse_schemars_regex(meta, cx).ok(),
|
||||||
(None, None, "validate") => self.regex = parse_validate_regex(meta, cx).ok(),
|
(None, None, "validate") => self.regex = parse_validate_regex(meta, cx).ok(),
|
||||||
(None, None, wat) => panic!("Unexpected attr type `{wat}` for regex item. This is a bug in schemars, please raise an issue!"),
|
(None, None, wat) => {
|
||||||
|
panic!("Unexpected attr type `{wat}` for regex item. This is a bug in schemars, please raise an issue!")
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"contains" => match (&self.regex, &self.contains) {
|
"contains" => match (&self.regex, &self.contains) {
|
||||||
(Some(_), _) => cx.mutual_exclusive_error(&meta, "regex"),
|
(Some(_), _) => cx.mutual_exclusive_error(&meta, "regex"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue