From 80f069656d86cd62f1f9fa92bd5aef7c68d4211a Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Sat, 19 Jan 2019 12:52:51 +0100 Subject: [PATCH] Revert "api/schema.rs: avoid Option(Option( nesting" This reverts commit ffdac1af01f16ab679b4bbd87f1126e54d338880. --- src/api/schema.rs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/api/schema.rs b/src/api/schema.rs index 9917e574..2cb6c90a 100644 --- a/src/api/schema.rs +++ b/src/api/schema.rs @@ -281,17 +281,7 @@ impl ObjectSchema { } pub fn optional>>(mut self, name: &'static str, schema: S) -> Self { - let schema = schema.into(); - let is_option = match schema.as_ref() { - Schema::Option(_) => true, - _ => false, - }; - if is_option { - self.properties.insert(name, schema); - } else { - self.properties.insert(name, Arc::new(Schema::Option(schema))); - } - + self.properties.insert(name, Arc::new(Schema::Option(schema.into()))); self } }