From e22f4cc9ac8aa13cdb4b5ecad4af2914433e4672 Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Wed, 6 Sep 2023 23:40:32 +0200 Subject: [PATCH] cargo fix --- nested/src/editors/list/editor.rs | 5 ++--- nested/src/editors/list/nav.rs | 10 +++++----- nested/src/editors/typeterm/cmd.rs | 12 +++++------- nested/src/editors/typeterm/ctx.rs | 2 +- nested/src/editors/typeterm/mod.rs | 27 +++++++++++++-------------- nested/src/tree/nav.rs | 2 +- nested/src/tree/node.rs | 6 +++--- 7 files changed, 30 insertions(+), 34 deletions(-) diff --git a/nested/src/editors/list/editor.rs b/nested/src/editors/list/editor.rs index 0c6f755..d234cb3 100644 --- a/nested/src/editors/list/editor.rs +++ b/nested/src/editors/list/editor.rs @@ -1,6 +1,6 @@ use { r3vi::{ - view::{ChannelSender, ChannelReceiver, port::UpdateTask, OuterViewPort, singleton::*, sequence::*}, + view::{OuterViewPort, singleton::*, sequence::*}, buffer::{singleton::*, vec::*} }, crate::{ @@ -10,8 +10,7 @@ use { diagnostics::Diagnostics, commander::ObjCommander }, - std::sync::{Arc, RwLock, Mutex}, - std::ops::Deref + std::sync::{Arc, RwLock} }; //<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> diff --git a/nested/src/editors/list/nav.rs b/nested/src/editors/list/nav.rs index 308564b..88bac81 100644 --- a/nested/src/editors/list/nav.rs +++ b/nested/src/editors/list/nav.rs @@ -248,7 +248,7 @@ impl TreeNav for ListEditor { let cur_item = self.data.get(cur.tree_addr[0] as usize); let cur_height = cur_item.read().unwrap().get_height(&TreeHeightOp::Max); - let mut new_item = self.data + let new_item = self.data .get_mut(idx as usize); let height = new_item.read().unwrap().get_height( @@ -356,7 +356,7 @@ impl TreeNav for ListEditor { let pxv_height = pxv_item.read().unwrap().get_height(&TreeHeightOp::Q) as isize; let cur_height = cur_item.read().unwrap().get_height(&TreeHeightOp::P) as isize; - let dist_from_ground = (cur_height - (depth as isize - 1)); + let dist_from_ground = cur_height - (depth as isize - 1); let n_steps_down = if gravity { pxv_height - dist_from_ground @@ -366,7 +366,7 @@ impl TreeNav for ListEditor { eprintln!("<- LEFT CROSS: pxv_height = {}, cur_height = {}, dist_from_ground = {}, n_steps_down = {}", pxv_height, cur_height, dist_from_ground, n_steps_down); new_addr.push( cur.tree_addr[0] - 1 ); - for i in 0..n_steps_down { + for _i in 0..n_steps_down { new_addr.push( -1 ); } @@ -376,7 +376,7 @@ impl TreeNav for ListEditor { let cur_height = cur_item.read().unwrap().get_height(&TreeHeightOp::Q) as isize; let nxd_height = nxd_item.read().unwrap().get_height(&TreeHeightOp::P) as isize; - let dist_from_ground = (cur_height - (depth as isize - 1)); + let dist_from_ground = cur_height - (depth as isize - 1); let n_steps_down = if gravity { nxd_height - dist_from_ground @@ -386,7 +386,7 @@ impl TreeNav for ListEditor { eprintln!("-> RIGHT CROSS: cur_height = {}, nxd_height = {}, dist_from_ground = {}, n_steps_down = {}", cur_height, nxd_height, dist_from_ground, n_steps_down); new_addr.push( cur.tree_addr[0] + 1 ); - for i in 0..n_steps_down { + for _i in 0..n_steps_down { new_addr.push( 0 ); } } diff --git a/nested/src/editors/typeterm/cmd.rs b/nested/src/editors/typeterm/cmd.rs index a070167..fba57be 100644 --- a/nested/src/editors/typeterm/cmd.rs +++ b/nested/src/editors/typeterm/cmd.rs @@ -1,23 +1,21 @@ use { r3vi::{ - buffer::{singleton::*, vec::*}, - view::{singleton::*, sequence::*, OuterViewPort} + view::{singleton::*, sequence::*} }, crate::{ - type_system::{Context, TypeID, TypeTerm, ReprTree}, - editors::{list::{ListCursorMode, ListEditor, ListCmd}}, + type_system::{ReprTree}, + editors::{list::{ListEditor, ListCmd}}, tree::{NestedNode, TreeNav, TreeNavResult, TreeCursor}, commander::ObjCommander }, - std::{sync::{Arc, RwLock, Mutex}, any::Any}, - cgmath::{Vector2}, + std::{sync::{Arc, RwLock}}, super::{TypeTermEditor, State} }; impl ObjCommander for TypeTermEditor { fn send_cmd_obj(&mut self, co: Arc>) -> TreeNavResult { - let cur = self.get_cursor(); + let _cur = self.get_cursor(); let cmd_obj = co.clone(); let cmd_obj = cmd_obj.read().unwrap(); diff --git a/nested/src/editors/typeterm/ctx.rs b/nested/src/editors/typeterm/ctx.rs index cbcdd0a..59ebafb 100644 --- a/nested/src/editors/typeterm/ctx.rs +++ b/nested/src/editors/typeterm/ctx.rs @@ -41,7 +41,7 @@ pub fn init_ctx(ctx: &mut Context) { if vertical_view { let editor = node.get_edit::().unwrap(); let mut e = editor.write().unwrap(); - let mut seg_view = PTYListStyle::new( ("","~",""), node.depth.get() ).get_seg_seq_view( &mut e ); + let seg_view = PTYListStyle::new( ("","~",""), node.depth.get() ).get_seg_seq_view( &mut e ); node = node.set_view( seg_view.to_grid_vertical().flatten() diff --git a/nested/src/editors/typeterm/mod.rs b/nested/src/editors/typeterm/mod.rs index 2e260de..6e8c086 100644 --- a/nested/src/editors/typeterm/mod.rs +++ b/nested/src/editors/typeterm/mod.rs @@ -6,8 +6,8 @@ pub use ctx::init_ctx; use { r3vi::{ - buffer::{singleton::*, vec::*}, - view::{singleton::*, sequence::*, OuterViewPort} + buffer::{singleton::*}, + view::{singleton::*, sequence::*} }, crate::{ type_system::{Context, TypeID, TypeTerm, ReprTree}, @@ -15,8 +15,7 @@ use { tree::{NestedNode, TreeNav, TreeNavResult, TreeCursor}, commander::ObjCommander }, - std::{sync::{Arc, RwLock, Mutex}, any::Any}, - cgmath::{Vector2} + std::{sync::{Arc, RwLock}} }; #[derive(PartialEq, Eq, Clone, Copy, Debug)] @@ -176,7 +175,7 @@ impl TypeTermEditor { node.goto(TreeCursor::home()); - let editor = node.editor.get(); + let _editor = node.editor.get(); self.close_char.set(node.close_char.get()); self.cur_node.set(node); self.state = new_state; @@ -221,7 +220,7 @@ impl TypeTermEditor { }) .to_grid() .flatten(); - let cc = editor.cur_node.get().close_char; + let _cc = editor.cur_node.get().close_char; let editor = Arc::new(RwLock::new(editor)); let mut node = NestedNode::new(ctx, data, depth) @@ -292,8 +291,8 @@ impl TypeTermEditor { pub fn normalize_empty(&mut self) { eprintln!("normalize singleton"); - let mut subladder_list_node = self.cur_node.get().clone(); - let mut subladder_list_edit = subladder_list_node.get_edit::().unwrap(); + let subladder_list_node = self.cur_node.get().clone(); + let subladder_list_edit = subladder_list_node.get_edit::().unwrap(); let subladder_list_edit = subladder_list_edit.read().unwrap(); if subladder_list_edit.data.len() == 0 { @@ -307,8 +306,8 @@ impl TypeTermEditor { */ pub fn normalize_singleton(&mut self) { eprintln!("normalize singleton"); - let mut subladder_list_node = self.cur_node.get().clone(); - let mut subladder_list_edit = subladder_list_node.get_edit::().unwrap(); + let subladder_list_node = self.cur_node.get().clone(); + let subladder_list_edit = subladder_list_node.get_edit::().unwrap(); let subladder_list_edit = subladder_list_edit.read().unwrap(); if subladder_list_edit.data.len() == 1 { @@ -333,11 +332,11 @@ impl TypeTermEditor { */ pub fn normalize_nested_ladder(&mut self) { let mut subladder_list_node = self.cur_node.get().clone(); - let mut subladder_list_edit = subladder_list_node.get_edit::().unwrap(); + let subladder_list_edit = subladder_list_node.get_edit::().unwrap(); let item = subladder_list_edit.write().unwrap().get_item().clone(); - if let Some(mut it_node) = item { + if let Some(it_node) = item { if it_node.get_type() == (&self.ctx, "( Type )").into() { let other_tt = it_node.get_edit::().unwrap(); @@ -441,8 +440,8 @@ impl TypeTermEditor { /* create a new NestedNode with TerminaltypeEditor, * that has same state & child-node as current node. */ - let mut old_edit_node = TypeTermEditor::new_node( self.ctx.clone(), self.depth ); - let mut old_edit_clone = old_edit_node.get_edit::().unwrap(); + let old_edit_node = TypeTermEditor::new_node( self.ctx.clone(), self.depth ); + let old_edit_clone = old_edit_node.get_edit::().unwrap(); old_edit_clone.write().unwrap().set_state( self.state ); old_edit_clone.write().unwrap().close_char.set( old_node.close_char.get() ); old_edit_clone.write().unwrap().cur_node.set( old_node ); diff --git a/nested/src/tree/nav.rs b/nested/src/tree/nav.rs index 39ba57b..488e26b 100644 --- a/nested/src/tree/nav.rs +++ b/nested/src/tree/nav.rs @@ -46,7 +46,7 @@ pub trait TreeNav { TreeCursor::default() } - fn get_height(&self, op: &TreeHeightOp) -> usize { + fn get_height(&self, _op: &TreeHeightOp) -> usize { 0 } diff --git a/nested/src/tree/node.rs b/nested/src/tree/node.rs index 39bf8b0..2e81ae3 100644 --- a/nested/src/tree/node.rs +++ b/nested/src/tree/node.rs @@ -1,9 +1,9 @@ use { - std::{sync::{Arc, RwLock, Mutex}, any::Any}, + std::{sync::{Arc, RwLock}, any::Any}, cgmath::{Vector2, Point2}, r3vi::{ - view::{ChannelReceiver, View, ViewPort, OuterViewPort, AnyOuterViewPort, singleton::*, sequence::*}, - buffer::{singleton::*, vec::*} + view::{View, ViewPort, OuterViewPort, AnyOuterViewPort, singleton::*, sequence::*}, + buffer::{singleton::*} }, crate::{ type_system::{ReprTree, Context, TypeTerm},