@@ -126,20 +126,20 @@ pub(crate) fn read_line() -> Result<String> {
126
126
127
127
#[ derive( Default ) ]
128
128
struct NotifyOnConsole {
129
- ram_notice_shown : bool ,
129
+ ram_notice_shown : RefCell < bool > ,
130
130
verbose : bool ,
131
131
}
132
132
133
133
impl NotifyOnConsole {
134
- fn handle ( & mut self , n : Notification < ' _ > ) {
134
+ fn handle ( & self , n : Notification < ' _ > ) {
135
135
if let Notification :: Install ( dist_notifications:: Notification :: Utils (
136
136
util_notifications:: Notification :: SetDefaultBufferSize ( _) ,
137
137
) ) = & n
138
138
{
139
- if self . ram_notice_shown {
139
+ if * self . ram_notice_shown . borrow ( ) {
140
140
return ;
141
141
} else {
142
- self . ram_notice_shown = true ;
142
+ * self . ram_notice_shown . borrow_mut ( ) = true ;
143
143
}
144
144
} ;
145
145
let level = n. level ( ) ;
@@ -169,25 +169,25 @@ impl NotifyOnConsole {
169
169
170
170
struct Notifier {
171
171
tracker : Arc < Mutex < DownloadTracker > > ,
172
- notifier : RefCell < NotifyOnConsole > ,
172
+ notifier : NotifyOnConsole ,
173
173
}
174
174
175
175
impl Notifier {
176
176
fn new ( verbose : bool , quiet : bool ) -> Self {
177
177
Self {
178
178
tracker : DownloadTracker :: new_with_display_progress ( !quiet) ,
179
- notifier : RefCell :: new ( NotifyOnConsole {
179
+ notifier : NotifyOnConsole {
180
180
verbose,
181
181
..Default :: default ( )
182
- } ) ,
182
+ } ,
183
183
}
184
184
}
185
185
186
186
fn handle ( & self , n : Notification < ' _ > ) {
187
187
if self . tracker . lock ( ) . unwrap ( ) . handle_notification ( & n) {
188
188
return ;
189
189
}
190
- self . notifier . borrow_mut ( ) . handle ( n) ;
190
+ self . notifier . handle ( n) ;
191
191
}
192
192
}
193
193
0 commit comments