Skip to content
This repository was archived by the owner on May 12, 2022. It is now read-only.

Commit e7c3b89

Browse files
committed
perf(tcw3): convert RcBorrowWeak without strong clone
This was made possible by a recent addition to `rc-borrow`: <CAD97/pointer-utils#59>
1 parent 3f902cd commit e7c3b89

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tcw3/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ ndarray = "0.13.0"
3131
neo_linked_list = { path = "../support/neo_linked_list" }
3232
owning_ref = "0.4.0"
3333
packed_simd = "0.3.0"
34-
rc-borrow = "1.0.0"
34+
rc-borrow = "1.3.0"
3535
rob = "0.1"
3636
rope = { path = "../support/rope" }
3737
sorted_diff = { path = "../support/sorted_diff" }

tcw3/src/ui/views/entry.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,8 +1558,7 @@ fn pend_raise_change(inner: RcBorrow<'_, Inner>) {
15581558
return;
15591559
}
15601560

1561-
// FIXME: Remove this extra `upgrade`-ing
1562-
let inner_weak = Rc::downgrade(&RcBorrow::upgrade(inner));
1561+
let inner_weak = RcBorrow::to_weak(inner);
15631562

15641563
inner.wm.invoke_on_update(move |wm| {
15651564
if let Some(inner) = inner_weak.upgrade() {

tcw3/src/uicore/window.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::{
99
cell::RefCell,
1010
cmp::{max, min},
1111
pin::Pin,
12-
rc::{Rc, Weak},
12+
rc::Weak,
1313
};
1414

1515
use super::{
@@ -82,7 +82,7 @@ impl HWndRef<'_> {
8282
pal_wnd_cell.as_ref().unwrap(),
8383
pal::WndAttrs {
8484
listener: Some(Box::new(PalWndListener {
85-
wnd: Rc::downgrade(&RcBorrow::upgrade(self.wnd)),
85+
wnd: RcBorrow::to_weak(self.wnd),
8686
})),
8787
..Default::default()
8888
},

0 commit comments

Comments
 (0)