Apply clippy fixes
This commit is contained in:
parent
39bae201eb
commit
824993ca76
6 changed files with 26 additions and 28 deletions
|
@ -263,7 +263,7 @@ impl SchemaGenerator {
|
|||
/// The keys of the returned `Map` are the [schema names](JsonSchema::schema_name), and the values are the schemas
|
||||
/// themselves.
|
||||
pub fn take_definitions(&mut self) -> Map<String, Schema> {
|
||||
std::mem::replace(&mut self.definitions, Map::default())
|
||||
std::mem::take(&mut self.definitions)
|
||||
}
|
||||
|
||||
/// Returns an iterator over the [visitors](SchemaSettings::visitors) being used by this `SchemaGenerator`.
|
||||
|
|
|
@ -128,7 +128,7 @@ impl<'a> serde::Serializer for Serializer<'a> {
|
|||
self.serialize_none()
|
||||
}
|
||||
|
||||
fn serialize_some<T: ?Sized>(mut self, value: &T) -> Result<Self::Ok, Self::Error>
|
||||
fn serialize_some<T: ?Sized>(self, value: &T) -> Result<Self::Ok, Self::Error>
|
||||
where
|
||||
T: serde::Serialize,
|
||||
{
|
||||
|
@ -153,7 +153,7 @@ impl<'a> serde::Serializer for Serializer<'a> {
|
|||
if self.gen.settings().option_add_null_type {
|
||||
schema = match schema {
|
||||
Schema::Bool(true) => Schema::Bool(true),
|
||||
Schema::Bool(false) => <()>::json_schema(&mut self.gen),
|
||||
Schema::Bool(false) => <()>::json_schema(self.gen),
|
||||
Schema::Object(SchemaObject {
|
||||
instance_type: Some(ref mut instance_type),
|
||||
..
|
||||
|
@ -163,7 +163,7 @@ impl<'a> serde::Serializer for Serializer<'a> {
|
|||
}
|
||||
schema => SchemaObject {
|
||||
subschemas: Some(Box::new(SubschemaValidation {
|
||||
any_of: Some(vec![schema, <()>::json_schema(&mut self.gen)]),
|
||||
any_of: Some(vec![schema, <()>::json_schema(self.gen)]),
|
||||
..Default::default()
|
||||
})),
|
||||
..Default::default()
|
||||
|
|
|
@ -17,7 +17,7 @@ fn eight() -> i32 {
|
|||
8
|
||||
}
|
||||
|
||||
fn null() -> () {}
|
||||
fn null() {}
|
||||
|
||||
#[test]
|
||||
fn examples() -> TestResult {
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::collections::HashMap;
|
|||
use util::*;
|
||||
|
||||
// In real code, this would typically be a Regex, potentially created in a `lazy_static!`.
|
||||
static STARTS_WITH_HELLO: &'static str = r"^[Hh]ello\b";
|
||||
static STARTS_WITH_HELLO: &str = r"^[Hh]ello\b";
|
||||
|
||||
const MIN: u32 = 1;
|
||||
const MAX: u32 = 1000;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue