@@ -156,13 +156,10 @@ pub struct SettingsHandle(Rc<RefCell<SettingsManager>>);
156156
157157impl SettingsHandle {
158158 pub fn load_or_default ( ) -> Self {
159- Self ( Rc :: new ( RefCell :: new ( SettingsManager :: load_from_dir (
160- & config_dir ( ) ,
161- ) ) ) )
159+ Self :: load_from ( & config_dir ( ) )
162160 }
163161
164- #[ cfg( test) ]
165- pub ( crate ) fn for_test ( dir : & Path ) -> Self {
162+ pub ( crate ) fn load_from ( dir : & Path ) -> Self {
166163 Self ( Rc :: new ( RefCell :: new ( SettingsManager :: load_from_dir ( dir) ) ) )
167164 }
168165
@@ -216,15 +213,8 @@ mod tests {
216213 manager. update_active_theme ( |theme| theme. author = Some ( "OpenMeters" . into ( ) ) ) ;
217214
218215 assert_eq ! ( manager. active_theme( ) , "default-custom-2" ) ;
219- assert_eq ! (
220- manager
221- . theme_store
222- . load( "default-custom-2" )
223- . unwrap( )
224- . author
225- . as_deref( ) ,
226- Some ( "OpenMeters" )
227- ) ;
216+ let theme = manager. theme_store . load ( "default-custom-2" ) . unwrap ( ) ;
217+ assert_eq ! ( theme. author. as_deref( ) , Some ( "OpenMeters" ) ) ;
228218 }
229219
230220 #[ test]
@@ -241,8 +231,7 @@ mod tests {
241231 if let Some ( original) = original {
242232 fs:: write ( & path, original) . unwrap ( ) ;
243233 }
244- let manager = SettingsManager :: load_from_dir ( dir. path ( ) ) ;
245- let handle = SettingsHandle ( Rc :: new ( RefCell :: new ( manager) ) ) ;
234+ let handle = SettingsHandle :: load_from ( dir. path ( ) ) ;
246235 let saved =
247236 || serde_json:: from_slice :: < serde_json:: Value > ( & fs:: read ( & path) . unwrap ( ) ) . unwrap ( ) ;
248237 let changed = handle. set ( User , |s| & mut s. decorations , decorations) ;
0 commit comments