ScopeConfig: Remove unnecessary changes, handle the case when data is empty

This commit is contained in:
Denys Vitali 2019-06-03 10:36:09 +02:00
parent e6bc864e05
commit 972de9497e
No known key found for this signature in database
GPG Key ID: 8883F38950E654A4
1 changed files with 5 additions and 8 deletions

View File

@ -124,9 +124,7 @@ impl Scope {
self.services.extend(cfg.services); self.services.extend(cfg.services);
if !cfg.data.is_empty() { if !cfg.data.is_empty() {
if (&self).data.is_some() { let mut data = self.data.unwrap_or(Extensions::new());
let mut data = self.data.unwrap();
for value in cfg.data.iter() { for value in cfg.data.iter() {
value.create(&mut data); value.create(&mut data);
@ -134,7 +132,6 @@ impl Scope {
self.data = Some(data); self.data = Some(data);
} }
}
self self
} }
} }