Skip to content

Commit 8e7fdf1

Browse files
committed
Fix clippy lints
1 parent ef9640b commit 8e7fdf1

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/widgets/tab.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub mod imp {
5353
pub(crate) gemini_client: RefCell<gemini::Client>,
5454
pub(crate) gemini_text_ext: RefCell<Option<GeminiTextExt>>,
5555
pub(crate) history: RefCell<Vec<HistoryItem>>,
56-
pub(crate) current_hi: RefCell<Option<usize>>,
56+
pub(crate) current_hi: Cell<Option<usize>>,
5757
#[template_child]
5858
pub(crate) scroll_win: TemplateChild<gtk::ScrolledWindow>,
5959
#[template_child]
@@ -70,7 +70,7 @@ pub mod imp {
7070
#[property(get = Self::history_status, builder(HistoryStatus::static_type()))]
7171
pub(crate) history_status: PhantomData<HistoryStatus>,
7272
#[property(get, set)]
73-
pub(crate) progress: RefCell<f64>,
73+
pub(crate) progress: Cell<f64>,
7474
#[property(get)]
7575
pub(crate) title: RefCell<String>,
7676
#[property(get)]
@@ -140,7 +140,7 @@ pub mod imp {
140140
impl Tab {
141141
fn history_status(&self) -> HistoryStatus {
142142
HistoryStatus {
143-
current: self.current_hi.borrow().unwrap_or(0),
143+
current: self.current_hi.get().unwrap_or(0),
144144
available: self.history.borrow().len(),
145145
}
146146
}
@@ -182,7 +182,7 @@ impl Tab {
182182
let links = imp.links.borrow();
183183
let (_, link) =
184184
Self::extract_linkhandler(&*links, gemini_text_ext.as_ref().unwrap(), x, y)?;
185-
self.parse_link(&link)?
185+
self.parse_link(link)?
186186
};
187187
if ctrl
188188
.current_event()
@@ -207,7 +207,7 @@ impl Tab {
207207
let links = imp.links.borrow();
208208
let (_, link) =
209209
Self::extract_linkhandler(&*links, gemini_text_ext.as_ref().unwrap(), x, y)?;
210-
self.parse_link(&link)?
210+
self.parse_link(link)?
211211
};
212212
let link_variant = link.as_str().to_variant();
213213

@@ -233,7 +233,7 @@ impl Tab {
233233
let entry = Self::extract_linkhandler(&*links, gemini_text_ext, x, y);
234234

235235
let link_ref = entry.as_ref().map(|x| x.1).unwrap_or("");
236-
if link_ref == &*imp.hover_url.borrow() {
236+
if link_ref == *imp.hover_url.borrow() {
237237
return Ok(());
238238
}
239239

@@ -270,7 +270,7 @@ impl Tab {
270270
let imp = self.imp();
271271
let i = {
272272
let mut history = imp.history.borrow_mut();
273-
let i = *imp.current_hi.borrow();
273+
let i = imp.current_hi.get();
274274
if let Some(i) = i {
275275
let scroll_progress = imp.scroll_win.vadjustment().value();
276276
history[i].scroll_progress = scroll_progress;
@@ -345,7 +345,7 @@ impl Tab {
345345
let imp = self.imp();
346346
let mut gemini_text_ext = imp.gemini_text_ext.borrow().clone().unwrap();
347347

348-
*self.imp().progress.borrow_mut() = 0.0;
348+
self.imp().progress.set(0.0);
349349
self.notify("progress");
350350

351351
*self.imp().title.borrow_mut() = url.to_string();
@@ -368,14 +368,14 @@ impl Tab {
368368
}
369369
}
370370
fn log_history_position(&self) {
371-
let i = self.imp().current_hi.borrow();
371+
let i = self.imp().current_hi.get();
372372
info!("history position: {i:?}");
373373
}
374374
pub fn previous(&self) -> Result<()> {
375375
let imp = self.imp();
376376
let i = {
377377
imp.current_hi
378-
.borrow()
378+
.get()
379379
.map(|i| i.checked_sub(1))
380380
.flatten()
381381
.context("going back in history")?
@@ -392,7 +392,7 @@ impl Tab {
392392
let imp = self.imp();
393393
let i = {
394394
imp.current_hi
395-
.borrow()
395+
.get()
396396
.map(|i| i + 1)
397397
.filter(|i| *i < imp.history.borrow().len())
398398
.context("going forward in history")?

0 commit comments

Comments
 (0)