]> git.proxmox.com Git - proxmox-backup.git/commitdiff
Revert "api/schema.rs: avoid Option(Option( nesting"
authorDietmar Maurer <dietmar@proxmox.com>
Sat, 19 Jan 2019 11:52:51 +0000 (12:52 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Sat, 19 Jan 2019 11:52:51 +0000 (12:52 +0100)
This reverts commit ffdac1af01f16ab679b4bbd87f1126e54d338880.

src/api/schema.rs

index 9917e574ffacfe4a1a889050d717aaa424a8f876..2cb6c90aada40737c08bbb015ebc1c55ae5a41e4 100644 (file)
@@ -281,17 +281,7 @@ impl ObjectSchema {
     }
 
     pub fn optional<S: Into<Arc<Schema>>>(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
     }
 }