From 310a48ee4e734272e469a2964a8dd106dbf423c1 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 22 Mar 2023 13:54:20 +0100 Subject: [PATCH] Simplify `ServiceObjectsExt::insert` --- crates/fj-kernel/src/insert.rs | 2 +- crates/fj-kernel/src/services/objects.rs | 18 ++++-------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/crates/fj-kernel/src/insert.rs b/crates/fj-kernel/src/insert.rs index 50e9bb0637..90b50ff41d 100644 --- a/crates/fj-kernel/src/insert.rs +++ b/crates/fj-kernel/src/insert.rs @@ -25,7 +25,7 @@ macro_rules! impl_insert { fn insert(self, objects: &mut Service) -> Handle { let handle = objects.$store.reserve(); - objects.insert(handle.clone(), self); + objects.insert((handle.clone(), self).into()); handle } } diff --git a/crates/fj-kernel/src/services/objects.rs b/crates/fj-kernel/src/services/objects.rs index fb919d04f6..d5f530fa89 100644 --- a/crates/fj-kernel/src/services/objects.rs +++ b/crates/fj-kernel/src/services/objects.rs @@ -1,7 +1,4 @@ -use crate::{ - objects::{Object, Objects, WithHandle}, - storage::Handle, -}; +use crate::objects::{Object, Objects, WithHandle}; use super::{Service, State}; @@ -45,18 +42,11 @@ pub struct InsertObject { /// Convenient API for `Service` pub trait ServiceObjectsExt { /// Insert an object - fn insert(&mut self, handle: Handle, object: T) - where - (Handle, T): Into>; + fn insert(&mut self, object: Object); } impl ServiceObjectsExt for Service { - fn insert(&mut self, handle: Handle, object: T) - where - (Handle, T): Into>, - { - self.execute(Operation::InsertObject { - object: (handle, object).into(), - }); + fn insert(&mut self, object: Object) { + self.execute(Operation::InsertObject { object }); } }