Преглед изворни кода

app: migrate from nightly to stable toolchain

darkfi пре 1 година
родитељ
комит
33d18f11dd

Разлика између датотеке није приказан због своје велике величине
+ 360 - 131
bin/app/Cargo.lock


+ 2 - 3
bin/app/Dockerfile

@@ -45,10 +45,9 @@ ENV NDK_HOME /usr/local/android-ndk-r25
 
 # Copy contents to container. Should only use this on a clean directory
 WORKDIR /root/
-#RUN git clone https://github.com/not-fl3/cargo-quad-apk cargo-apk
-RUN git clone --branch quad_injs https://github.com/narodnik/cargo-quad-apk cargo-apk
+RUN git clone https://github.com/not-fl3/cargo-quad-apk cargo-apk
 # For deterministic builds, we want a deterministic toolchain
-#RUN cd /root/cargo-apk && git checkout 8962f6888e748e201f6ac2ced411669a3f939e07
+RUN cd /root/cargo-apk && git checkout f3b865610b79a2b1b9d2b90600c36390a9e19569
 
 # Install binary
 RUN cargo install --path /root/cargo-apk

+ 1 - 1
bin/app/Makefile

@@ -1,7 +1,7 @@
 .POSIX:
 
 # Cargo binary
-CARGO = cargo +nightly
+CARGO = cargo
 
 RELEASE_APK = target/android-artifacts/release/apk/darkfi-app.apk
 DEBUG_APK = target/android-artifacts/debug/apk/darkfi-app.apk

+ 1 - 1
bin/app/rust-toolchain.toml

@@ -1,2 +1,2 @@
 [toolchain]
-channel = "nightly-2025-04-10"
+channel = "stable"

+ 8 - 6
bin/app/src/app/mod.rs

@@ -166,7 +166,7 @@ impl App {
             Ok(db) => db,
             Err(err) => {
                 e!("Sled database '{}' failed to open: {err}!", db_path.display());
-                return Err(Error::SledDbErr);
+                return Err(Error::SledDbErr)
             }
         };
 
@@ -176,7 +176,8 @@ impl App {
         prop.set_array_len(2);
         window.add_property(prop).unwrap();
 
-        let setting_root = Arc::new(SceneNode3::new("setting", SceneNodeType3::SettingRoot));
+        let setting_root = SceneNode3::new("setting", SceneNodeType3::SettingRoot);
+        let setting_root = setting_root.setup_null();
         let settings_tree = db.open_tree("settings").unwrap();
         let settings = Arc::new(PluginSettings {
             setting_root: setting_root.clone(),
@@ -208,7 +209,8 @@ impl App {
 
         d!("Schema loaded");
 
-        let plugin = Arc::new(SceneNode3::new("plugin", SceneNodeType3::PluginRoot));
+        let plugin = SceneNode3::new("plugin", SceneNodeType3::PluginRoot);
+        let plugin = plugin.setup_null();
         self.sg_root.clone().link(plugin.clone());
 
         #[cfg(feature = "enable-plugins")]
@@ -380,21 +382,21 @@ impl App {
 
     async fn trigger_draw(&self) {
         let window_node = self.sg_root.clone().lookup_node("/window").expect("no window attached!");
-        match &window_node.pimpl {
+        match window_node.pimpl() {
             Pimpl::Window(win) => win.draw().await,
             _ => panic!("wrong pimpl"),
         }
     }
     async fn start_procs(&self) {
         let window_node = self.sg_root.clone().lookup_node("/window").unwrap();
-        match &window_node.pimpl {
+        match window_node.pimpl() {
             Pimpl::Window(win) => win.clone().start(self.event_pub.clone(), self.ex.clone()).await,
             _ => panic!("wrong pimpl"),
         }
 
         let plugins = self.sg_root.clone().lookup_node("/plugin").unwrap();
         for plugin in plugins.get_children() {
-            match &plugin.pimpl {
+            match plugin.pimpl() {
                 Pimpl::DarkIrc(darkirc) => darkirc.clone().start(self.ex.clone()).await,
                 _ => panic!("wrong pimpl"),
             }

+ 1 - 1
bin/app/src/app/schema/chat.rs

@@ -566,7 +566,7 @@ pub async fn make(
     layer_node.clone().link(chatview_node.clone());
 
     if is_first_time {
-        let chatview = match &chatview_node.pimpl {
+        let chatview = match chatview_node.pimpl() {
             Pimpl::ChatView(obj) => obj.as_ref(),
             _ => panic!("wrong pimpl for chatview"),
         };

+ 2 - 2
bin/app/src/expr/compile.rs

@@ -58,7 +58,7 @@ impl Token {
     fn flatten(self) -> Vec<Self> {
         match self {
             Self::NestedExpr(tokens) => {
-                let tokens = Box::into_inner(tokens);
+                let tokens: Vec<_> = *tokens;
                 tokens.into_iter().map(|t| t.flatten()).flatten().collect()
             }
             _ => vec![self],
@@ -375,7 +375,7 @@ fn to_rpn(tokens: Vec<Token>) -> Result<Vec<Token>> {
                                     Box::new(else_expr),
                                 )));
                                 out.push(token);
-                                continue 'mainloop
+                                continue 'mainloop;
                             }
                             cond_expr.push(token);
                         }

+ 2 - 2
bin/app/src/gfx/shader.rs

@@ -78,12 +78,12 @@ vertex RasterizerData vertexShader(Vertex v [[stage_in]])
     out.color = v.in_color;
     out.uv = v.texcoord;
 
-    return out;
+    return out
 }
 
 fragment float4 fragmentShader(RasterizerData in [[stage_in]], texture2d<float> tex [[texture(0)]], sampler texSmplr [[sampler(0)]])
 {
-    return in.color * tex.sample(texSmplr, in.uv);
+    return in.color * tex.sample(texSmplr, in.uv)
 }
 
 "#;

+ 0 - 19
bin/app/src/main.rs

@@ -16,25 +16,6 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-// channel wait until deadline
-#![feature(deadline_api)]
-// Adds remainder() fn for String::split() result
-#![feature(str_split_whitespace_remainder)]
-// instant.elapsed().as_millis_f32()
-#![feature(duration_millis_float)]
-// Allow attributes on statements and code blocks
-#![feature(stmt_expr_attributes)]
-// if let Some(is_foo) = is_foo && is_foo { ... }
-#![feature(let_chains)]
-// consume a box
-#![feature(box_into_inner)]
-// we need Arc::get_mut_unchecked() to workaround the lack of Arc::new_cyclic() which
-// accepts async fns.
-// See https://github.com/rust-lang/rust/issues/112566
-#![feature(get_mut_unchecked)]
-// string.chars().advance_back_by(n), not strictly needed but makes life easier
-#![feature(iter_advance_by)]
-
 // Use these to incrementally fix warnings with cargo fix
 //#![allow(warnings, unused)]
 //#![deny(unused_imports)]

+ 1 - 1
bin/app/src/mesh.rs

@@ -90,7 +90,7 @@ impl MeshBuilder {
         let clipped = match &self.clipper {
             Some(clipper) => {
                 let Some(clipped) = clipper.clip(&obj) else {
-                    return;
+                    return
                 };
                 clipped
             }

+ 1 - 1
bin/app/src/net.rs

@@ -476,7 +476,7 @@ impl ZeroMQAdapter {
                         loop {
                             let Ok(signal_data) = recvr.recv().await else {
                                 // Die
-                                break;
+                                break
                             };
 
                             let mut m = zeromq::ZmqMessage::from(signal_data);

+ 3 - 3
bin/app/src/plugin/darkirc.rs

@@ -193,7 +193,7 @@ impl DarkIrc {
             Ok(db) => db,
             Err(err) => {
                 e!("Sled database '{}' failed to open: {err}!", evgr_path.display());
-                return Err(Error::SledDbErr);
+                return Err(Error::SledDbErr)
             }
         };
 
@@ -242,7 +242,7 @@ impl DarkIrc {
             Ok(p2p) => p2p,
             Err(err) => {
                 e!("Create p2p network failed: {err}!");
-                return Err(Error::ServiceFailed);
+                return Err(Error::ServiceFailed)
             }
         };
 
@@ -260,7 +260,7 @@ impl DarkIrc {
             Ok(evgr) => evgr,
             Err(err) => {
                 e!("Create event graph failed: {err}!");
-                return Err(Error::ServiceFailed);
+                return Err(Error::ServiceFailed)
             }
         };
 

+ 2 - 2
bin/app/src/plugin/mod.rs

@@ -107,7 +107,7 @@ impl PluginSettings {
         let atom = &mut PropertyAtomicGuard::new();
         for setting_node in self.setting_root.get_children().iter() {
             if setting_node.typ != SceneNodeType::Setting {
-                continue;
+                continue
             }
 
             let value = setting_node.get_property("value").clone().unwrap();
@@ -176,7 +176,7 @@ impl PluginSettings {
     pub fn save_settings(&self) {
         for setting_node in self.setting_root.get_children().iter() {
             if setting_node.typ != SceneNodeType::Setting {
-                continue;
+                continue
             }
 
             let value = setting_node.get_property("value").clone().unwrap();

+ 4 - 4
bin/app/src/prop/mod.rs

@@ -443,13 +443,13 @@ impl Property {
         if self.min_val.is_some() {
             let min = self.min_val.as_ref().unwrap().as_u32()?;
             if val < min {
-                return Err(Error::PropertyOutOfRange);
+                return Err(Error::PropertyOutOfRange)
             }
         }
         if self.max_val.is_some() {
             let max = self.max_val.as_ref().unwrap().as_u32()?;
             if val > max {
-                return Err(Error::PropertyOutOfRange);
+                return Err(Error::PropertyOutOfRange)
             }
         }
         self.set_raw_value(role, i, PropertyValue::Uint32(val))?;
@@ -466,13 +466,13 @@ impl Property {
         if self.min_val.is_some() {
             let min = self.min_val.as_ref().unwrap().as_f32()?;
             if val < min {
-                return Err(Error::PropertyOutOfRange);
+                return Err(Error::PropertyOutOfRange)
             }
         }
         if self.max_val.is_some() {
             let max = self.max_val.as_ref().unwrap().as_f32()?;
             if val > max {
-                return Err(Error::PropertyOutOfRange);
+                return Err(Error::PropertyOutOfRange)
             }
         }
         self.set_raw_value(role, i, PropertyValue::Float32(val))?;

+ 36 - 14
bin/app/src/scene.rs

@@ -26,7 +26,7 @@ use std::{
     fmt,
     future::Future,
     str::FromStr,
-    sync::{Arc, RwLock as SyncRwLock, Weak},
+    sync::{Arc, OnceLock, RwLock as SyncRwLock, Weak},
 };
 
 use crate::{
@@ -63,24 +63,24 @@ impl FromStr for ScenePath {
 
     fn from_str(s: &str) -> Result<Self> {
         if s.is_empty() || s.chars().nth(0).unwrap() != '/' {
-            return Err(Error::InvalidScenePath);
+            return Err(Error::InvalidScenePath)
         }
         if s == "/" {
-            return Ok(ScenePath(VecDeque::new()));
+            return Ok(ScenePath(VecDeque::new()))
         }
 
         let mut tokens = s.split('/');
         // Should start with a /
         let initial = tokens.next().expect("should not be empty");
         if !initial.is_empty() {
-            return Err(Error::InvalidScenePath);
+            return Err(Error::InvalidScenePath)
         }
 
         let mut path = VecDeque::new();
         for token in tokens {
             // There should not be any double slashes //
             if token.is_empty() {
-                return Err(Error::InvalidScenePath);
+                return Err(Error::InvalidScenePath)
             }
             path.push_back(token.to_string());
         }
@@ -134,7 +134,7 @@ pub struct SceneNode {
     pub props: Vec<PropertyPtr>,
     pub sigs: SyncRwLock<Vec<SignalPtr>>,
     pub methods: Vec<Method>,
-    pub pimpl: Pimpl,
+    pub pimpl: OnceLock<Pimpl>,
 }
 
 impl SceneNode {
@@ -152,11 +152,11 @@ impl SceneNode {
             props: vec![],
             sigs: SyncRwLock::new(vec![]),
             methods: vec![],
-            pimpl: Pimpl::Null,
+            pimpl: OnceLock::new(),
         }
     }
 
-    pub async fn setup<F, Fut>(self, pimpl_fn: F) -> SceneNodePtr
+    pub async fn setup<F, Fut>(self, pimpl_fn: F) -> Arc<Self>
     where
         F: FnOnce(SceneNodeWeak) -> Fut,
         Fut: Future<Output = Pimpl>,
@@ -170,13 +170,29 @@ impl SceneNode {
         }
 
         let pimpl = pimpl_fn(weak_self).await;
-        // Arc::new_cyclic() doesnt allow async so we do this instead
-        unsafe {
-            Arc::get_mut_unchecked(&mut self_).pimpl = pimpl;
+        assert_eq!(Arc::strong_count(&self_), 1);
+        self_.pimpl.set(pimpl).unwrap();
+        self_
+    }
+
+    pub fn setup_null(self) -> Arc<Self> {
+        let mut self_ = Arc::new(self);
+        let weak_self = Arc::downgrade(&self_);
+
+        // Initial props
+        for prop in &self_.props {
+            prop.set_parent(weak_self.clone());
         }
+
+        assert_eq!(Arc::strong_count(&self_), 1);
+        self_.pimpl.set(Pimpl::Null);
         self_
     }
 
+    pub fn pimpl<'a>(&'a self) -> &'a Pimpl {
+        self.pimpl.get().unwrap()
+    }
+
     pub fn link(self: Arc<Self>, child: SceneNodePtr) {
         let mut childs_parent = child.parent.write().unwrap();
         assert!(childs_parent.is_none());
@@ -212,7 +228,7 @@ impl SceneNode {
     }
     pub fn add_property(&mut self, prop: Property) -> Result<()> {
         if self.has_property(&prop.name) {
-            return Err(Error::PropertyAlreadyExists);
+            return Err(Error::PropertyAlreadyExists)
         }
         self.props.push(Arc::new(prop));
         Ok(())
@@ -306,7 +322,7 @@ impl SceneNode {
     ) -> Result<()> {
         let name = name.into();
         if self.has_signal(&name) {
-            return Err(Error::SignalAlreadyExists);
+            return Err(Error::SignalAlreadyExists)
         }
         let fmt = fmt
             .into_iter()
@@ -370,7 +386,7 @@ impl SceneNode {
     ) -> Result<()> {
         let name = name.into();
         if self.has_method(&name) {
-            return Err(Error::MethodAlreadyExists);
+            return Err(Error::MethodAlreadyExists)
         }
         let args = args
             .into_iter()
@@ -535,3 +551,9 @@ pub enum Pimpl {
     EmojiPicker(ui::EmojiPickerPtr),
     DarkIrc(plugin::DarkIrcPtr),
 }
+
+impl std::fmt::Debug for Pimpl {
+    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+        write!(f, "Pimpl")
+    }
+}

+ 1 - 1
bin/app/src/text/atlas.rs

@@ -153,7 +153,7 @@ impl<'a> Atlas<'a> {
     /// The texture ID is a struct member: `rendered_atlas.texture_id`.
     pub fn make(self) -> RenderedAtlas {
         //if self.glyph_ids.is_empty() {
-        //    return Err(Error::AtlasIsEmpty);
+        //    return Err(Error::AtlasIsEmpty)
         //}
 
         assert_eq!(self.glyph_ids.len(), self.sprites.len());

+ 1 - 1
bin/app/src/text/mod.rs

@@ -104,7 +104,7 @@ impl<'a> Iterator for GlyphPositionIter<'a> {
     fn next(&mut self) -> Option<Self::Item> {
         assert!(self.i <= self.glyphs.len());
         if self.i == self.glyphs.len() {
-            return None;
+            return None
         }
 
         let glyph = &self.glyphs[self.i];

+ 9 - 6
bin/app/src/text/shape.rs

@@ -174,18 +174,21 @@ impl ShapedGlyphs {
 
     fn consume(iter: &mut Peekable<IntoIter<GlyphInfo>>, cluster_bound: usize) -> Vec<GlyphInfo> {
         let mut consumed = vec![];
-        while let Some(glyph) = iter.peek() &&
-            glyph.cluster_start <= cluster_bound
-        {
+        while let Some(glyph) = iter.peek() {
+            if glyph.cluster_start > cluster_bound {
+                break
+            }
+
             let glyph = iter.next().unwrap();
             consumed.push(glyph);
         }
         consumed
     }
     fn drop_replaced(iter: &mut Peekable<IntoIter<GlyphInfo>>, cluster_end: usize) {
-        while let Some(glyph) = iter.peek() &&
-            glyph.cluster_start < cluster_end
-        {
+        while let Some(glyph) = iter.peek() {
+            if glyph.cluster_start >= cluster_end {
+                break
+            }
             let _ = iter.next();
         }
     }

+ 1 - 2
bin/app/src/text/wrap.rs

@@ -88,8 +88,7 @@ fn tokenize(font_size: f32, window_scale: f32, glyphs: &Vec<Glyph>) -> Vec<Token
 
             // Reset ruler
             lhs = -1.;
-            #[allow(unused_assignments)]
-            rhs = 0.;
+            //rhs = 0.;
             // take() blanked token_glyphs above
 
             token_type = new_type;

+ 1 - 1
bin/app/src/text2/atlas.rs

@@ -171,7 +171,7 @@ impl<'a> Atlas<'a> {
     /// The texture ID is a struct member: `rendered_atlas.texture_id`.
     pub fn make(self) -> RenderedAtlas {
         //if self.glyph_ids.is_empty() {
-        //    return Err(Error::AtlasIsEmpty);
+        //    return Err(Error::AtlasIsEmpty)
         //}
 
         assert_eq!(self.glyph_ids.len(), self.sprites.len());

+ 1 - 1
bin/app/src/text2/editor/android.rs

@@ -34,7 +34,7 @@ fn char16_to_byte_index(s: &str, char_idx: usize) -> Option<usize> {
 }
 fn byte_to_char16_index(s: &str, byte_idx: usize) -> Option<usize> {
     if byte_idx > s.len() || !s.is_char_boundary(byte_idx) {
-        return None;
+        return None
     }
     Some(s[..byte_idx].encode_utf16().count())
 }

+ 5 - 5
bin/app/src/ui/chatedit.rs

@@ -78,7 +78,7 @@ fn char16_to_byte_index(s: &str, char_idx: usize) -> Option<usize> {
 }
 fn byte_to_char16_index(s: &str, byte_idx: usize) -> Option<usize> {
     if byte_idx > s.len() || !s.is_char_boundary(byte_idx) {
-        return None;
+        return None
     }
     Some(s[..byte_idx].encode_utf16().count())
 }
@@ -842,13 +842,13 @@ impl ChatEdit {
                         d!("start touch: DragSelectHandle state [side=-1]");
                         // Set touch_state status to enable begin dragging them
                         touch_info.state = TouchStateAction::DragSelectHandle { side: -1 };
-                        return true;
+                        return true
                     }
                     if p2.dist_sq(&touch_pos) <= TOUCH_RADIUS_SQ {
                         d!("start touch: DragSelectHandle state [side=1]");
                         // Set touch_state status to enable begin dragging them
                         touch_info.state = TouchStateAction::DragSelectHandle { side: 1 };
-                        return true;
+                        return true
                     }
                 }
 
@@ -1191,7 +1191,7 @@ impl ChatEdit {
         t!("redraw()");
         let Some(draw_update) = self.make_draw_calls(trace_id, atom).await else {
             error!(target: "ui::chatedit", "Text failed to draw");
-            return;
+            return
         };
         self.render_api.replace_draw_calls(timest, draw_update.draw_calls);
     }
@@ -1656,7 +1656,7 @@ impl UIObject for ChatEdit {
         self.is_mouse_hover.store(rect.contains(mouse_pos), Ordering::Relaxed);
 
         if !self.mouse_btn_held.load(Ordering::Relaxed) {
-            return false;
+            return false
         }
 
         let atom = &mut PropertyAtomicGuard::new();

+ 7 - 8
bin/app/src/ui/chatview/mod.rs

@@ -135,7 +135,7 @@ impl TouchInfo {
 
         // Now drop all old samples older than 40ms
         while let Some((instant, _)) = self.samples.front() {
-            if instant.elapsed().as_millis_f32() <= 40. {
+            if instant.elapsed().as_micros() <= 40_000 {
                 break
             }
             self.samples.pop_front().unwrap();
@@ -143,7 +143,7 @@ impl TouchInfo {
     }
 
     fn first_sample(&self) -> Option<(f32, f32)> {
-        self.samples.front().map(|(t, s)| (t.elapsed().as_millis_f32(), *s))
+        self.samples.front().map(|(t, s)| (t.elapsed().as_micros() as f32 / 1000., *s))
     }
 }
 
@@ -974,7 +974,8 @@ impl UIObject for ChatView {
                     let start_scroll = touch_info.start_scroll;
                     let start_y = touch_info.start_y;
 
-                    let start_elapsed = touch_info.start_instant.elapsed().as_millis_f32();
+                    let start_elapsed =
+                        touch_info.start_instant.elapsed().as_micros() as f32 / 1000.;
                     if start_elapsed > select_hold_time && touch_info.is_select_mode.is_none() {
                         // Did we move?
                         if (touch_y - start_y).abs() < BIG_EPSILON {
@@ -988,8 +989,8 @@ impl UIObject for ChatView {
                     touch_info.push_sample(touch_y);
 
                     // Only update screen every 20ms. Avoid wasting cycles.
-                    let last_elapsed = touch_info.last_instant.elapsed().as_millis_f32();
-                    let do_update = last_elapsed > 20.;
+                    let last_elapsed = touch_info.last_instant.elapsed().as_micros();
+                    let do_update = last_elapsed > 20_000;
                     if do_update {
                         touch_info.last_instant = std::time::Instant::now();
                     }
@@ -1012,9 +1013,7 @@ impl UIObject for ChatView {
                 }
 
                 // We are in selection mode so don't scroll the screen until touch phase ends.
-                if let Some(is_select_mode) = is_select_mode &&
-                    is_select_mode
-                {
+                if is_select_mode == Some(true) {
                     if ENABLE_SELECT {
                         self.select_line(touch_y).await;
                     }

+ 4 - 4
bin/app/src/ui/chatview/page.rs

@@ -744,7 +744,7 @@ impl MessageBuffer {
     /// explicitly rendering since it may be off screen.
     pub fn adjust_width(&mut self, line_width: f32) {
         if (line_width - self.line_width).abs() < f32::EPSILON {
-            return;
+            return
         }
         self.line_width = line_width;
 
@@ -840,7 +840,7 @@ impl MessageBuffer {
         if self.msgs.is_empty() {
             let msg_idx = self.msgs.len();
             self.msgs.push(msg);
-            return self.msgs.last_mut().unwrap().get_privmsg_mut();
+            return self.msgs.last_mut().unwrap().get_privmsg_mut()
         }
 
         // We only add lines inside pages.
@@ -848,7 +848,7 @@ impl MessageBuffer {
         // When a line is before the first page, it will get preloaded as a new page.
         let oldest_timest = self.oldest_timestamp().unwrap();
         if timest < oldest_timest {
-            return None;
+            return None
         }
 
         // Timestamps go from most recent backwards
@@ -870,7 +870,7 @@ impl MessageBuffer {
         };
 
         self.msgs.insert(idx, msg);
-        return self.msgs[idx].get_privmsg_mut();
+        return self.msgs[idx].get_privmsg_mut()
     }
 
     pub fn push_privmsg(

+ 8 - 6
bin/app/src/ui/editbox/editable.rs

@@ -112,7 +112,7 @@ impl RenderedEditable {
                 return i
             }
         }
-        return self.glyphs.len();
+        return self.glyphs.len()
     }
 
     /// Converts glyph pos to idx in the string
@@ -124,7 +124,7 @@ impl RenderedEditable {
             }
             idx += glyph.substr.len();
         }
-        return idx;
+        return idx
     }
 
     pub fn has_underline(&self) -> bool {
@@ -143,10 +143,10 @@ impl RenderedEditable {
 
             let midpoint = glyph_rect.x + glyph_rect.w / 2.;
             if x < midpoint {
-                return glyph_idx;
+                return glyph_idx
             }
             assert!(x >= midpoint);
-            return glyph_idx + 1;
+            return glyph_idx + 1
         }
         // Everything to the right is at the end
         self.glyphs.len()
@@ -270,11 +270,13 @@ impl Editable {
         self.end_compose();
 
         let mut chars = self.before_text.chars();
-        chars.advance_back_by(before);
+        // nightly feature, commenting it for now
+        //chars.advance_back_by(before);
         self.before_text = chars.as_str().to_string();
 
         let mut chars = self.after_text.chars();
-        chars.advance_by(after);
+        // nightly feature, commenting it for now
+        //chars.advance_by(after);
         self.after_text = chars.as_str().to_string();
     }
 

+ 7 - 7
bin/app/src/ui/editbox/mod.rs

@@ -426,14 +426,14 @@ impl EditBox {
         let mut rhs = 0.;
 
         if cursor_pos == 0 {
-            return 0.;
+            return 0.
         }
 
         for (glyph_idx, (mut glyph_rect, glyph)) in glyph_pos_iter.zip(glyphs.iter()).enumerate() {
             glyph_rect.x -= scroll;
 
             if cursor_pos == glyph_idx {
-                return glyph_rect.x;
+                return glyph_rect.x
             }
 
             rhs = glyph_rect.rhs();
@@ -965,13 +965,13 @@ impl EditBox {
                 d!("TouchStateAction::DragSelectHandle [side=-1]");
                 // Set touch_state status to enable begin dragging them
                 touch_info.state = TouchStateAction::DragSelectHandle { side: -1 };
-                return true;
+                return true
             }
             if p2.dist_sq(&pos_rel) <= TOUCH_RADIUS_SQ {
                 d!("TouchStateAction::DragSelectHandle [side=1]");
                 // Set touch_state status to enable begin dragging them
                 touch_info.state = TouchStateAction::DragSelectHandle { side: 1 };
-                return true;
+                return true
             }
         }
 
@@ -1152,7 +1152,7 @@ impl EditBox {
 
         let rect_w = self.rect.get().w;
         if rhs <= rect_w {
-            return 0.;
+            return 0.
         }
         let max_scroll = rhs - rect_w;
         max_scroll
@@ -1178,7 +1178,7 @@ impl EditBox {
 
         let Some(draw_update) = self.make_draw_calls() else {
             error!(target: "ui::editbox", "Text failed to draw");
-            return;
+            return
         };
 
         self.render_api.replace_draw_calls(timest, draw_update.draw_calls);
@@ -1492,7 +1492,7 @@ impl UIObject for EditBox {
         self.is_mouse_hover.store(rect.contains(mouse_pos), Ordering::Relaxed);
 
         if !self.mouse_btn_held.load(Ordering::Relaxed) {
-            return false;
+            return false
         }
 
         // if active and selection_active, then use x to modify the selection.

+ 1 - 1
bin/app/src/ui/editbox/repeat.rs

@@ -51,7 +51,7 @@ impl PressedKeysSmoothRepeat {
         if is_initial_keypress {
             trace!(target: "PressedKeysSmoothRepeat", "remove key {:?}", key);
             self.pressed_keys.remove(&key);
-            return 1;
+            return 1
         }
 
         // Insert key if not exists

+ 2 - 2
bin/app/src/ui/emoji_picker/emoji.rs

@@ -154,11 +154,11 @@ fn unescape_unicode(input: &str) -> Option<String> {
         .replace_all(input, |caps: &regex::Captures| {
             let Ok(code) = u32::from_str_radix(&caps[1], 16) else {
                 failed = true;
-                return String::new();
+                return String::new()
             };
             let Some(chr) = char::from_u32(code) else {
                 failed = true;
-                return String::new();
+                return String::new()
             };
             chr.to_string()
         })

+ 1 - 1
bin/app/src/ui/emoji_picker/mod.rs

@@ -209,7 +209,7 @@ impl EmojiPicker {
 
         let Some(draw_update) = self.get_draw_calls(parent_rect, trace_id, atom) else {
             error!(target: "ui::emoji_picker", "Emoji picker failed to draw");
-            return;
+            return
         };
         self.render_api.replace_draw_calls(timest, draw_update.draw_calls);
         t!("redraw DONE [trace_id={trace_id}]");

+ 1 - 1
bin/app/src/ui/image.rs

@@ -138,7 +138,7 @@ impl Image {
 
         let Some(draw_update) = self.get_draw_calls(parent_rect, trace_id).await else {
             error!(target: "ui::image", "Image failed to draw");
-            return;
+            return
         };
         self.render_api.replace_draw_calls(timest, draw_update.draw_calls);
         t!("redraw() DONE [trace_id={trace_id}]");

+ 1 - 1
bin/app/src/ui/layer.rs

@@ -100,7 +100,7 @@ impl Layer {
 
         let Some(draw_update) = self.get_draw_calls(parent_rect, trace_id, atom).await else {
             error!(target: "ui::layer", "Layer failed to draw [trace_id={trace_id}]");
-            return;
+            return
         };
         self.render_api.replace_draw_calls(timest, draw_update.draw_calls);
         t!(

+ 2 - 2
bin/app/src/ui/mod.rs

@@ -187,7 +187,7 @@ impl<T: Send + Sync + 'static> OnModify<T> {
 }
 
 pub fn get_ui_object_ptr(node: &SceneNode3) -> Arc<dyn UIObject + Send> {
-    match &node.pimpl {
+    match node.pimpl() {
         Pimpl::Layer(obj) => obj.clone(),
         Pimpl::VectorArt(obj) => obj.clone(),
         Pimpl::Text(obj) => obj.clone(),
@@ -203,7 +203,7 @@ pub fn get_ui_object_ptr(node: &SceneNode3) -> Arc<dyn UIObject + Send> {
     }
 }
 pub fn get_ui_object3<'a>(node: &'a SceneNode3) -> &'a dyn UIObject {
-    match &node.pimpl {
+    match node.pimpl() {
         Pimpl::Layer(obj) => obj.as_ref(),
         Pimpl::VectorArt(obj) => obj.as_ref(),
         Pimpl::Text(obj) => obj.as_ref(),

+ 1 - 1
bin/app/src/ui/text.rs

@@ -139,7 +139,7 @@ impl Text {
 
         let Some(draw_update) = self.get_draw_calls(parent_rect, trace_id).await else {
             error!(target: "ui::text", "Text failed to draw [trace_id={trace_id}]");
-            return;
+            return
         };
         self.render_api.replace_draw_calls(timest, draw_update.draw_calls);
         t!("Text::redraw() DONE [trace_id={trace_id}]");

+ 1 - 1
bin/app/src/ui/vector_art/mod.rs

@@ -111,7 +111,7 @@ impl VectorArt {
 
         let Some(draw_update) = self.get_draw_calls(parent_rect, trace_id).await else {
             error!(target: "ui::vector_art", "Mesh failed to draw [trace_id={trace_id}]");
-            return;
+            return
         };
         self.render_api.replace_draw_calls(timest, draw_update.draw_calls);
     }

Неке датотеке нису приказане због велике количине промена