From 7a24111f0875e1c872f9d363e387b1cf3b2516ee Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Sun, 18 Dec 2022 01:39:01 +0100 Subject: [PATCH] fix warnings --- nested/src/char_editor.rs | 16 +++++-------- nested/src/core/context.rs | 2 +- nested/src/diagnostics.rs | 16 ++++++------- nested/src/grid/flatten.rs | 6 ++--- nested/src/index/buffer.rs | 2 +- nested/src/integer/editor.rs | 4 ++-- nested/src/list/editor.rs | 8 ++----- nested/src/list/nav.rs | 12 ---------- nested/src/list/pty_editor.rs | 9 ++------ nested/src/list/segment.rs | 4 ++-- nested/src/make_editor.rs | 33 ++++++++++++--------------- nested/src/product/editor.rs | 17 +++++++------- nested/src/product/nav.rs | 16 ++++++------- nested/src/product/segment.rs | 18 +++++++-------- nested/src/sequence/decorator.rs | 2 +- nested/src/singleton/buffer.rs | 2 +- nested/src/sum/editor.rs | 12 +++------- nested/src/tree/cursor.rs | 3 +-- nested/src/tree/nav.rs | 2 +- nested/src/tree/node.rs | 5 ++-- nested/src/type_term_editor.rs | 11 ++++----- nested/src/vec/buffer.rs | 2 +- shell/src/main.rs | 39 ++++++++++++-------------------- 23 files changed, 94 insertions(+), 147 deletions(-) diff --git a/nested/src/char_editor.rs b/nested/src/char_editor.rs index 9a6e927..f160586 100644 --- a/nested/src/char_editor.rs +++ b/nested/src/char_editor.rs @@ -1,21 +1,17 @@ use { crate::{ - core::{OuterViewPort, ViewPort, Context}, - list::{ListEditor}, - sequence::{SequenceView, SequenceViewExt}, + core::{OuterViewPort, Context}, singleton::{SingletonBuffer, SingletonView}, terminal::{ - TerminalAtom, TerminalEditor, TerminalEditorResult, TerminalEvent, TerminalStyle, - TerminalView, + TerminalAtom, + TerminalEvent, + TerminalStyle }, - tree::{TreeCursor, TreeNav, TreeNavResult}, - diagnostics::Diagnostics, - Nested, tree::NestedNode, Commander + tree::NestedNode, Commander }, std::sync::Arc, std::sync::RwLock, - termion::event::{Event, Key}, - cgmath::Vector2 + termion::event::{Event, Key} }; pub struct CharEditor { diff --git a/nested/src/core/context.rs b/nested/src/core/context.rs index e5a5f0f..522c24f 100644 --- a/nested/src/core/context.rs +++ b/nested/src/core/context.rs @@ -296,7 +296,7 @@ impl Context { } pub fn get_editor_ctor(&self, ty: &TypeTerm) -> Option>, TypeTerm, usize) -> Option>> + Send + Sync>> { - if let TypeTerm::Type{ id, args } = ty.clone() { + if let TypeTerm::Type{ id, args: _ } = ty.clone() { if let Some(m) = self.editor_ctors.get(&id).cloned() { Some(m) } else { diff --git a/nested/src/diagnostics.rs b/nested/src/diagnostics.rs index c5e8b8a..0706538 100644 --- a/nested/src/diagnostics.rs +++ b/nested/src/diagnostics.rs @@ -1,7 +1,7 @@ use { crate::{ - core::{OuterViewPort, ViewPort}, - sequence::{SequenceView, SequenceViewExt, decorator::{PTYSeqDecorate, SeqDecorStyle}}, + core::{OuterViewPort}, + sequence::{SequenceView}, vec::{VecBuffer}, index::{buffer::IndexBuffer}, terminal::{ @@ -28,13 +28,13 @@ pub fn make_error(msg: OuterViewPort) -> Message { mb.insert_iter(vec![ (Point2::new(0, 0), make_label("error: ") - .map_item(|p,a| a + .map_item(|_p,a| a .add_style_back(TerminalStyle::bold(true)) .add_style_back(TerminalStyle::fg_color((200,0,0)))) ), (Point2::new(1, 0), msg - .map_item(|p,a| a + .map_item(|_p,a| a .add_style_back(TerminalStyle::fg_color((180,180,180)))) ) ]); @@ -50,13 +50,13 @@ pub fn make_warn(msg: OuterViewPort) -> Message { mb.insert_iter(vec![ (Point2::new(0, 0), make_label("warning: ") - .map_item(|p,a| a + .map_item(|_p,a| a .add_style_back(TerminalStyle::bold(true)) .add_style_back(TerminalStyle::fg_color((200,200,0)))) ), (Point2::new(1, 0), msg - .map_item(|p,a| a + .map_item(|_p,a| a .add_style_back(TerminalStyle::fg_color((180,180,180)))) ) ]); @@ -72,13 +72,13 @@ pub fn make_todo(msg: OuterViewPort) -> Message { mb.insert_iter(vec![ (Point2::new(0, 0), make_label("todo: ") - .map_item(|p,a| a + .map_item(|_p,a| a .add_style_back(TerminalStyle::bold(true)) .add_style_back(TerminalStyle::fg_color((180,180,250)))) ), (Point2::new(1, 0), msg - .map_item(|p,a| a + .map_item(|_p,a| a .add_style_back(TerminalStyle::fg_color((180,180,180)))) ) ]); diff --git a/nested/src/grid/flatten.rs b/nested/src/grid/flatten.rs index c934029..bbcc325 100644 --- a/nested/src/grid/flatten.rs +++ b/nested/src/grid/flatten.rs @@ -1,6 +1,6 @@ use { crate::{ - core::{InnerViewPort, Observer, ObserverBroadcast, OuterViewPort, View, ViewPort, port::UpdateTask}, + core::{InnerViewPort, Observer, ObserverBroadcast, OuterViewPort, View, ViewPort}, grid::{GridView, GridWindowIterator}, index::{IndexArea, IndexView}, projection::ProjectionHelper, @@ -174,8 +174,8 @@ where for chunk_idx in GridWindowIterator::from(top_range.clone()) { if let Some(chunk) = self.chunks.get_mut(&chunk_idx) { - let old_offset = chunk.offset; - let old_limit = chunk.limit; + let _old_offset = chunk.offset; + let _old_limit = chunk.limit; //chunk.limit = Point2::new( col_widths[chunk_idx.x as usize]-1, row_heights[chunk_idx.y as usize]-1 ); chunk.limit = *chunk.view.area().range().end(); diff --git a/nested/src/index/buffer.rs b/nested/src/index/buffer.rs index d5f0851..efb2d84 100644 --- a/nested/src/index/buffer.rs +++ b/nested/src/index/buffer.rs @@ -1,6 +1,6 @@ use { crate::{ - core::{InnerViewPort, OuterViewPort, ViewPort, Observer, ObserverBroadcast, View}, + core::{InnerViewPort, OuterViewPort, ViewPort, View}, index::{IndexArea, IndexView}, }, std::sync::RwLock, diff --git a/nested/src/integer/editor.rs b/nested/src/integer/editor.rs index f55c5f3..ef0a516 100644 --- a/nested/src/integer/editor.rs +++ b/nested/src/integer/editor.rs @@ -1,6 +1,6 @@ use { crate::{ - core::{OuterViewPort, ViewPort}, + core::{OuterViewPort}, list::{PTYListEditor}, sequence::{SequenceView, SequenceViewExt, decorator::{PTYSeqDecorate, SeqDecorStyle}}, singleton::{SingletonBuffer, SingletonView}, @@ -77,7 +77,7 @@ impl TerminalEditor for DigitEditor { mb.insert_iter(vec![ (Point2::new(1, 0), make_label("invalid digit '")), (Point2::new(2, 0), make_label(&format!("{}", *c)) - .map_item(|p,a| a.add_style_back(TerminalStyle::fg_color((140,140,250))))), + .map_item(|_p,a| a.add_style_back(TerminalStyle::fg_color((140,140,250))))), (Point2::new(3, 0), make_label("'")) ]); self.msg.push(crate::diagnostics::make_error(mb.get_port().flatten())); diff --git a/nested/src/list/editor.rs b/nested/src/list/editor.rs index 14589e4..e3101ca 100644 --- a/nested/src/list/editor.rs +++ b/nested/src/list/editor.rs @@ -2,23 +2,19 @@ use { crate::{ core::{OuterViewPort, ViewPort}, list::{ - ListCursor, ListCursorMode, + ListCursor, ListSegment, ListSegmentSequence, segment::PTYSegment }, sequence::{SequenceView}, singleton::{SingletonBuffer, SingletonView}, terminal::{ - make_label, TerminalEditor, TerminalEditorResult, TerminalEvent, TerminalStyle, TerminalView, }, Nested, - tree::{TreeCursor, TreeNav, TreeNavResult}, - vec::VecBuffer, - color::{bg_style_from_depth, fg_style_from_depth} + vec::VecBuffer }, std::sync::{Arc, RwLock}, - termion::event::{Event, Key}, }; //<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> diff --git a/nested/src/list/nav.rs b/nested/src/list/nav.rs index bcc9c8b..7aaf6b4 100644 --- a/nested/src/list/nav.rs +++ b/nested/src/list/nav.rs @@ -1,24 +1,12 @@ use { crate::{ - core::{OuterViewPort, ViewPort}, list::{ ListCursor, ListCursorMode, - ListSegment, ListSegmentSequence, ListEditor }, - sequence::SequenceView, - singleton::{SingletonBuffer, SingletonView}, - terminal::{ - make_label, TerminalEditor, TerminalEditorResult, TerminalEvent, TerminalStyle, - TerminalView, - }, tree::{TreeCursor, TreeNav, TreeNavResult}, - vec::VecBuffer, - color::{bg_style_from_depth, fg_style_from_depth}, Nested }, - std::sync::{Arc, RwLock}, - termion::event::{Event, Key}, cgmath::Vector2 }; diff --git a/nested/src/list/pty_editor.rs b/nested/src/list/pty_editor.rs index 26fb5b1..0767c5a 100644 --- a/nested/src/list/pty_editor.rs +++ b/nested/src/list/pty_editor.rs @@ -1,21 +1,17 @@ use { crate::{ - core::{OuterViewPort, ViewPort, TypeTerm}, + core::{OuterViewPort}, list::{ ListCursor, ListCursorMode, - ListSegment, ListSegmentSequence, ListEditor }, sequence::{SequenceView, decorator::{SeqDecorStyle, PTYSeqDecorate}}, - singleton::{SingletonBuffer, SingletonView}, terminal::{ - make_label, TerminalEditor, TerminalEditorResult, TerminalEvent, TerminalStyle, + TerminalEditor, TerminalEditorResult, TerminalEvent, TerminalView, }, tree::{TreeCursor, TreeNav, TreeNavResult}, diagnostics::{Diagnostics}, - vec::VecBuffer, - color::{bg_style_from_depth, fg_style_from_depth}, Nested }, std::sync::{Arc, RwLock}, @@ -287,7 +283,6 @@ where ItemEditor: Nested + ?Sized + Send + Sync + 'static {} use crate::{ - char_editor::CharEditor, sequence::SequenceViewExt, StringGen }; diff --git a/nested/src/list/segment.rs b/nested/src/list/segment.rs index 0aa2819..3068455 100644 --- a/nested/src/list/segment.rs +++ b/nested/src/list/segment.rs @@ -98,7 +98,7 @@ where ItemEditor: Nested + ?Sized + Send + Sync + 'static fn get(&self, idx: &usize) -> Option { let c = self.cursor.get(); - Some(if let Some(mut cur) = c.idx { + Some(if let Some(cur) = c.idx { match c.mode { ListCursorMode::Select => { ListSegment::Item { @@ -158,7 +158,7 @@ where ItemEditor: Nested + ?Sized + Send + Sync + 'static }), data: proj_helper.new_sequence_arg(1, data_port, |s: &mut Self, idx| { - if let Some(mut cur_idx) = s.cur_cursor.idx { + if let Some(cur_idx) = s.cur_cursor.idx { match s.cur_cursor.mode { ListCursorMode::Insert => { if *idx < cur_idx as usize { diff --git a/nested/src/make_editor.rs b/nested/src/make_editor.rs index 5261006..fa38aa9 100644 --- a/nested/src/make_editor.rs +++ b/nested/src/make_editor.rs @@ -1,27 +1,22 @@ use { crate::{ - core::{TypeTerm, TypeLadder, Context, OuterViewPort}, - terminal::{TerminalView, TerminalEditor, TerminalEvent, TerminalEditorResult, make_label}, - tree::{TreeNav}, + core::{TypeTerm, Context}, integer::PosIntEditor, - list::{ListEditor, PTYListEditor}, + list::{PTYListEditor}, sequence::{decorator::{SeqDecorStyle}}, - product::editor::ProductEditor, sum::SumEditor, char_editor::CharEditor, - diagnostics::Diagnostics, Nested }, - cgmath::{Vector2, Point2}, std::sync::{Arc, RwLock}, }; pub fn init_editor_ctx(parent: Arc>) -> Arc> { - let mut ctx = Arc::new(RwLock::new(Context::with_parent(Some(parent)))); + let ctx = Arc::new(RwLock::new(Context::with_parent(Some(parent)))); ctx.write().unwrap().add_editor_ctor( "Char", Arc::new( - |ctx: Arc>, ty: TypeTerm, _depth: usize| { + |ctx: Arc>, _ty: TypeTerm, _depth: usize| { Some( Arc::new(RwLock::new(CharEditor::new_node(&ctx))) as Arc>) @@ -34,7 +29,7 @@ pub fn init_editor_ctx(parent: Arc>) -> Arc> { |ctx: Arc>, ty: TypeTerm, depth: usize| { match ty { TypeTerm::Type { - id, args + id: _, args } => { if args.len() > 0 { // todo: factor style out of type arGS @@ -93,7 +88,7 @@ pub fn init_editor_ctx(parent: Arc>) -> Arc> { ctx.write().unwrap().add_editor_ctor( "Symbol", Arc::new( - |ctx: Arc>, ty: TypeTerm, depth: usize| { + |ctx: Arc>, _ty: TypeTerm, depth: usize| { Context::make_editor( ctx.clone(), ctx.read().unwrap().type_term_from_str("( List Char 0 )").unwrap(), @@ -105,7 +100,7 @@ pub fn init_editor_ctx(parent: Arc>) -> Arc> { ctx.write().unwrap().add_editor_ctor( "String", Arc::new( - |ctx: Arc>, ty: TypeTerm, depth: usize| { + |ctx: Arc>, _ty: TypeTerm, depth: usize| { Context::make_editor( ctx.clone(), ctx.read().unwrap().type_term_from_str("( List Char 3 )").unwrap(), @@ -117,7 +112,7 @@ pub fn init_editor_ctx(parent: Arc>) -> Arc> { ctx.write().unwrap().add_editor_ctor( "TypeTerm", Arc::new( - |ctx: Arc>, ty: TypeTerm, depth: usize| { + |ctx: Arc>, _ty: TypeTerm, depth: usize| { let mut s = SumEditor::new( vec![ Context::make_editor(ctx.clone(), ctx.read().unwrap().type_term_from_str("( Symbol )").unwrap(), depth+1).unwrap(), @@ -140,17 +135,17 @@ pub fn init_editor_ctx(parent: Arc>) -> Arc> { } pub fn init_math_ctx(parent: Arc>) -> Arc> { - let mut ctx = Arc::new(RwLock::new(Context::with_parent(Some(parent)))); + let ctx = Arc::new(RwLock::new(Context::with_parent(Some(parent)))); ctx.write().unwrap().add_typename("MachineInt".into()); ctx.write().unwrap().add_typename("Digit".into()); ctx.write().unwrap().add_typename("BigEndian".into()); ctx.write().unwrap().add_editor_ctor( "PosInt", Arc::new( - |ctx: Arc>, ty: TypeTerm, _depth: usize| { + |_ctx: Arc>, ty: TypeTerm, _depth: usize| { match ty { TypeTerm::Type { - id, args + id: _, args } => { if args.len() > 0 { match args[0] { @@ -176,11 +171,11 @@ pub fn init_math_ctx(parent: Arc>) -> Arc> { } pub fn init_os_ctx(parent: Arc>) -> Arc> { - let mut ctx = Arc::new(RwLock::new(Context::with_parent(Some(parent)))); + let ctx = Arc::new(RwLock::new(Context::with_parent(Some(parent)))); ctx.write().unwrap().add_editor_ctor( "PathSegment", Arc::new( - |ctx: Arc>, ty: TypeTerm, depth: usize| { + |ctx: Arc>, _ty: TypeTerm, depth: usize| { Context::make_editor( ctx.clone(), ctx.read().unwrap().type_term_from_str("( List Char 0 )").unwrap(), @@ -192,7 +187,7 @@ pub fn init_os_ctx(parent: Arc>) -> Arc> { ctx.write().unwrap().add_editor_ctor( "Path", Arc::new( - |ctx: Arc>, ty: TypeTerm, depth: usize| { + |ctx: Arc>, _ty: TypeTerm, depth: usize| { Context::make_editor( ctx.clone(), ctx.read().unwrap().type_term_from_str("( List PathSegment 6 )").unwrap(), diff --git a/nested/src/product/editor.rs b/nested/src/product/editor.rs index b5971ce..9bac1fe 100644 --- a/nested/src/product/editor.rs +++ b/nested/src/product/editor.rs @@ -1,24 +1,24 @@ use { crate::{ - core::{ViewPort, OuterViewPort, TypeLadder, Context}, + core::{OuterViewPort, TypeLadder, Context}, terminal::{ TerminalEditor, TerminalEditorResult, TerminalEvent, TerminalView }, - vec::{VecBuffer, MutableVecAccess}, - index::{buffer::{IndexBuffer, MutableIndexAccess}, IndexView}, + vec::{VecBuffer}, + index::{buffer::{IndexBuffer, MutableIndexAccess}}, list::ListCursorMode, product::{segment::ProductEditorSegment}, sequence::{SequenceView}, tree::{TreeNav, TreeNavResult}, - diagnostics::{Diagnostics, Message}, + diagnostics::{Diagnostics}, terminal::{TerminalStyle}, Nested }, - cgmath::{Vector2, Point2}, + cgmath::{Point2}, std::sync::{Arc, RwLock}, termion::event::{Event, Key}, - std::ops::{Deref, DerefMut} + std::ops::{DerefMut} }; pub struct ProductEditor { @@ -155,7 +155,7 @@ impl ProductEditor { self.msg_buf.update(idx as usize, Some(b.get_port().to_sequence().map( |msg| { let mut msg = msg.clone(); - msg.port = msg.port.map_item(|p,a| a.add_style_back(TerminalStyle::bg_color((40,40,40)))); + msg.port = msg.port.map_item(|_p,a| a.add_style_back(TerminalStyle::bg_color((40,40,40)))); msg } ))); @@ -189,7 +189,7 @@ impl TerminalEditor for ProductEditor { let mut update_segment = false; let result = if let Some(mut segment) = self.get_cur_segment_mut().as_deref_mut() { - if let Some(ProductEditorSegment::N{ t, editor, ed_depth, cur_depth, cur_dist }) = segment.deref_mut() { + if let Some(ProductEditorSegment::N{ t, editor, ed_depth, cur_depth, cur_dist: _ }) = segment.deref_mut() { *cur_depth = self.get_cursor().tree_addr.len(); if let Some(e) = editor.clone() { @@ -227,7 +227,6 @@ impl TerminalEditor for ProductEditor { } } else { unreachable!(); - TerminalEditorResult::Exit } } else { TerminalEditorResult::Exit diff --git a/nested/src/product/nav.rs b/nested/src/product/nav.rs index ed7d41f..b14d65b 100644 --- a/nested/src/product/nav.rs +++ b/nested/src/product/nav.rs @@ -6,9 +6,8 @@ use { product::{segment::ProductEditorSegment, ProductEditor}, Nested }, - cgmath::{Point2, Vector2}, - std::{sync::{Arc, RwLock}, ops::{Deref, DerefMut}}, - termion::event::{Event, Key}, + cgmath::{Vector2}, + std::{ops::{DerefMut}}, }; impl TreeNav for ProductEditor { @@ -56,7 +55,7 @@ impl TreeNav for ProductEditor { let old_cursor = self.cursor; if let Some(mut segment) = self.get_cur_segment_mut() { - if let Some(ProductEditorSegment::N{ t: _t, editor, ed_depth, cur_depth, cur_dist:_ }) = segment.deref_mut() { + if let Some(ProductEditorSegment::N{ t: _t, editor, ed_depth: _, cur_depth: _, cur_dist:_ }) = segment.deref_mut() { if let Some(e) = editor { let mut e = e.write().unwrap(); e.goto(TreeCursor::none()); @@ -67,7 +66,7 @@ impl TreeNav for ProductEditor { if c.tree_addr.len() > 0 { self.cursor = Some(crate::modulo(c.tree_addr.remove(0), self.n_indices.len() as isize)); if let Some(mut element) = self.get_cur_segment_mut() { - if let Some(ProductEditorSegment::N{ t, editor, ed_depth, cur_depth, cur_dist:_ }) = element.deref_mut() { + if let Some(ProductEditorSegment::N{ t, editor, ed_depth, cur_depth: _, cur_dist:_ }) = element.deref_mut() { if let Some(e) = editor { e.write().unwrap().goto(c.clone()); } else if c.tree_addr.len() > 0 { @@ -90,7 +89,7 @@ impl TreeNav for ProductEditor { TreeNavResult::Continue } else { - if let Some(mut ed) = self.get_cur_editor() { + if let Some(ed) = self.get_cur_editor() { ed.write().unwrap().goto(TreeCursor::none()); } @@ -124,7 +123,7 @@ impl TreeNav for ProductEditor { if direction.y > 0 { // dn if let Some(mut element) = self.get_cur_segment_mut() { - if let Some(ProductEditorSegment::N{ t, editor, ed_depth, cur_depth, cur_dist:_ }) = element.deref_mut() { + if let Some(ProductEditorSegment::N{ t, editor, ed_depth, cur_depth: _, cur_dist:_ }) = element.deref_mut() { if let Some(e) = editor { let mut e = e.write().unwrap(); e.goby(direction); @@ -175,7 +174,7 @@ impl TreeNav for ProductEditor { let old_cursor = self.cursor; let nav_result = if let Some(mut element) = self.get_cur_segment_mut() { - if let Some(ProductEditorSegment::N{ t, editor, ed_depth, cur_depth, cur_dist:_ }) = element.deref_mut() { + if let Some(ProductEditorSegment::N{ t: _, editor, ed_depth: _, cur_depth, cur_dist:_ }) = element.deref_mut() { if let Some(e) = editor { let mut ce = e.write().unwrap(); //\\//\\//\\//\\ @@ -193,7 +192,6 @@ impl TreeNav for ProductEditor { TreeNavResult::Continue } else { panic!("unplausible direction.y on exit"); - TreeNavResult::Continue } } else if direction.y > 0 { // dn diff --git a/nested/src/product/segment.rs b/nested/src/product/segment.rs index 5ecd717..2cd0e5b 100644 --- a/nested/src/product/segment.rs +++ b/nested/src/product/segment.rs @@ -2,15 +2,13 @@ use { crate::{ core::{OuterViewPort, TypeLadder, Context}, terminal::{ - TerminalEditor, TerminalStyle, TerminalView, + TerminalStyle, TerminalView, make_label }, - list::{ListCursorMode}, color::{bg_style_from_depth, fg_style_from_depth}, Nested }, - std::{sync::{Arc, RwLock}, ops::{Deref, DerefMut}}, - termion::event::{Event, Key}, + std::{sync::{Arc, RwLock}}, }; #[derive(Clone)] @@ -32,12 +30,12 @@ impl ProductEditorSegment { make_label(t.as_str()) .map_item({ let depth = *depth; - move |i, x| + move |_i, x| x.add_style_back(fg_style_from_depth(depth)).add_style_back(TerminalStyle::italic(true)) } ), - ProductEditorSegment::N { t: _, editor: Some(e), ed_depth, cur_depth, cur_dist } => + ProductEditorSegment::N { t: _, editor: Some(e), ed_depth, cur_depth: _, cur_dist } => e.read().unwrap() .get_term_view() .map_item({ @@ -45,7 +43,7 @@ impl ProductEditorSegment { let d = *ed_depth; let cur_dist = *cur_dist; - move |i, x| { + move |_i, x| { let c = e.read().unwrap().get_cursor(); let cur_depth = c.tree_addr.len(); let select = @@ -65,11 +63,11 @@ impl ProductEditorSegment { ProductEditorSegment::N{ t, editor: None, ed_depth, cur_depth, cur_dist } => make_label(&ctx.read().unwrap().type_term_to_str(&t[0])) .map_item({ - let cur_depth = *cur_depth; - let ed_depth = *ed_depth; + let _cur_depth = *cur_depth; + let _ed_depth = *ed_depth; let cur_dist = *cur_dist; - move |i, x| + move |_i, x| x.add_style_back(TerminalStyle::fg_color((215,140,95))) .add_style_back(bg_style_from_depth(if cur_dist == 0 { 0 } else { usize::MAX })) .add_style_back(TerminalStyle::bold(cur_dist == 0)) diff --git a/nested/src/sequence/decorator.rs b/nested/src/sequence/decorator.rs index b379056..ca86862 100644 --- a/nested/src/sequence/decorator.rs +++ b/nested/src/sequence/decorator.rs @@ -195,7 +195,7 @@ impl PTYSeqDecorate for OuterViewPort OuterViewPort { match style { SeqDecorStyle::Plain => self diff --git a/nested/src/singleton/buffer.rs b/nested/src/singleton/buffer.rs index accfbcf..0f3b1f3 100644 --- a/nested/src/singleton/buffer.rs +++ b/nested/src/singleton/buffer.rs @@ -1,6 +1,6 @@ use { crate::{ - core::{InnerViewPort, OuterViewPort, Observer, ObserverBroadcast, View, ViewPort}, + core::{InnerViewPort, OuterViewPort, View, ViewPort}, singleton::SingletonView, }, std::sync::RwLock, diff --git a/nested/src/sum/editor.rs b/nested/src/sum/editor.rs index ccf5fa3..59946c5 100644 --- a/nested/src/sum/editor.rs +++ b/nested/src/sum/editor.rs @@ -1,24 +1,18 @@ use { crate::{ - core::{ViewPort, OuterViewPort, TypeLadder, Context}, + core::{ViewPort, OuterViewPort}, terminal::{ TerminalEditor, TerminalEditorResult, TerminalEvent, TerminalView }, - vec::{VecBuffer, MutableVecAccess}, - index::{buffer::{IndexBuffer, MutableIndexAccess}, IndexView}, - list::ListCursorMode, - product::{segment::ProductEditorSegment}, sequence::{SequenceView}, tree::{TreeNav, TreeCursor, TreeNavResult}, diagnostics::{Diagnostics, Message}, - terminal::{TerminalStyle}, Nested }, - cgmath::{Vector2, Point2}, + cgmath::{Vector2}, std::sync::{Arc, RwLock}, - termion::event::{Event, Key}, - std::ops::{Deref, DerefMut} + termion::event::{Key} }; pub struct SumEditor { diff --git a/nested/src/tree/cursor.rs b/nested/src/tree/cursor.rs index 4827e96..1175e9f 100644 --- a/nested/src/tree/cursor.rs +++ b/nested/src/tree/cursor.rs @@ -1,6 +1,5 @@ use { - crate::list::ListCursorMode, - cgmath::Vector2 + crate::list::ListCursorMode }; //<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> diff --git a/nested/src/tree/nav.rs b/nested/src/tree/nav.rs index c2f23cc..36b7ff0 100644 --- a/nested/src/tree/nav.rs +++ b/nested/src/tree/nav.rs @@ -36,7 +36,7 @@ pub trait TreeNav { 0 } - fn goby(&mut self, direction: Vector2) -> TreeNavResult { + fn goby(&mut self, _direction: Vector2) -> TreeNavResult { TreeNavResult::Exit } diff --git a/nested/src/tree/node.rs b/nested/src/tree/node.rs index 9acdac2..24e5b7e 100644 --- a/nested/src/tree/node.rs +++ b/nested/src/tree/node.rs @@ -3,12 +3,11 @@ use { cgmath::Vector2, crate::{ core::{ViewPort, OuterViewPort, AnyOuterViewPort, context::ReprTree, Context}, - singleton::{SingletonView, SingletonBuffer}, + singleton::{SingletonBuffer}, sequence::SequenceView, terminal::{TerminalView, TerminalEvent, TerminalEditor, TerminalEditorResult}, diagnostics::{Diagnostics, Message}, - tree::{TreeNav, TreeCursor, TreeNavResult}, - Commander, ObjCommander, + tree::{TreeNav, TreeCursor, TreeNavResult}, ObjCommander, Nested }, }; diff --git a/nested/src/type_term_editor.rs b/nested/src/type_term_editor.rs index 5503389..fc04d7e 100644 --- a/nested/src/type_term_editor.rs +++ b/nested/src/type_term_editor.rs @@ -1,6 +1,6 @@ use { crate::{ - core::{ViewPort, OuterViewPort, TypeLadder, Context}, + core::{OuterViewPort, Context}, terminal::{TerminalEvent, TerminalView, TerminalEditor, TerminalEditorResult}, sequence::{SequenceView, decorator::SeqDecorStyle}, list::{PTYListEditor}, @@ -11,11 +11,10 @@ use { integer::PosIntEditor, Nested }, - cgmath::{Vector2, Point2}, - termion::event::{Event, Key}, + cgmath::{Vector2}, + termion::event::{Key}, std::{ - sync::{Arc, RwLock}, - any::Any + sync::{Arc, RwLock} } }; @@ -114,7 +113,7 @@ impl TerminalEditor for TypeTermEditor { }, _ => { if *c == '(' { - let mut child = Arc::new(RwLock::new(TypeTermEditor { + let _child = Arc::new(RwLock::new(TypeTermEditor { ty: self.ty.clone(), node: SumEditor::new( vec![ diff --git a/nested/src/vec/buffer.rs b/nested/src/vec/buffer.rs index 2c145b2..9c91009 100644 --- a/nested/src/vec/buffer.rs +++ b/nested/src/vec/buffer.rs @@ -1,6 +1,6 @@ use { crate::{ - core::{InnerViewPort, OuterViewPort, Observer, ObserverBroadcast, View, ViewPort}, + core::{InnerViewPort, OuterViewPort, View, ViewPort}, vec::VecDiff, }, std::sync::RwLock, diff --git a/shell/src/main.rs b/shell/src/main.rs index 302f739..de6bab5 100644 --- a/shell/src/main.rs +++ b/shell/src/main.rs @@ -8,29 +8,20 @@ mod pty; mod plot; use { - crate::{ -// process::ProcessLauncher, -// command::Commander - }, cgmath::{Point2, Vector2}, nested::{ - core::{port::UpdateTask, Observer, OuterViewPort, AnyOuterViewPort, View, ViewPort, Context, TypeTerm, ReprTree}, + core::{port::UpdateTask, Observer, AnyOuterViewPort, ViewPort, Context, ReprTree}, index::IndexArea, list::{ListCursorMode, PTYListEditor}, - sequence::{SequenceView, decorator::{SeqDecorStyle, Separate}}, + sequence::{decorator::{SeqDecorStyle}}, terminal::{ make_label, Terminal, TerminalAtom, TerminalCompositor, TerminalEditor, - TerminalEditorResult, TerminalEvent, TerminalStyle, TerminalView, + TerminalEditorResult, TerminalEvent, TerminalStyle, }, tree::{TreeNav, TreeCursor, TreeNavResult}, vec::VecBuffer, - integer::{PosIntEditor}, - char_editor::CharEditor, - product::ProductEditor, - sum::SumEditor, diagnostics::{Diagnostics}, - index::{buffer::IndexBuffer}, - Nested + index::{buffer::IndexBuffer} }, std::sync::{Arc, RwLock}, termion::event::{Event, Key}, @@ -44,7 +35,7 @@ async fn main() { let mut term = Terminal::new(term_port.outer()); let term_writer = term.get_writer(); - let mut portmutex = Arc::new(RwLock::new(())); + let portmutex = Arc::new(RwLock::new(())); // Update Loop // let tp = term_port.clone(); @@ -53,7 +44,7 @@ async fn main() { async move { loop { { - let l = portmutex.write().unwrap(); + let _l = portmutex.write().unwrap(); tp.update(); } async_std::task::sleep(std::time::Duration::from_millis(10)).await; @@ -67,12 +58,12 @@ async fn main() { let ctx = nested::make_editor::init_math_ctx(ctx); let ctx = nested::make_editor::init_os_ctx(ctx); - let mut vb = VecBuffer::::new(); - let mut rt_char = ReprTree::new_leaf( + let vb = VecBuffer::::new(); + let rt_char = ReprTree::new_leaf( ctx.read().unwrap().type_term_from_str("( List Char )").unwrap(), AnyOuterViewPort::from(vb.get_port()) ); - let mut rt_digit = ReprTree::upcast(&rt_char, ctx.read().unwrap().type_term_from_str("( List ( Digit 10 ) )").unwrap()); + let rt_digit = ReprTree::upcast(&rt_char, ctx.read().unwrap().type_term_from_str("( List ( Digit 10 ) )").unwrap()); rt_digit.write().unwrap().insert_branch( ReprTree::new_leaf( ctx.read().unwrap().type_term_from_str("( List MachineInt )").unwrap(), @@ -194,7 +185,7 @@ async fn main() { let mut b = VecBuffer::new(); b.push( make_label("@") - .map_item(|p,a| a + .map_item(|_p,a| a .add_style_back(TerminalStyle::bold(true)) .add_style_back(TerminalStyle::fg_color((120,120,0)))) ); @@ -202,12 +193,12 @@ async fn main() { for x in entry.addr.iter() { b.push( make_label(&format!("{}", x)) - .map_item(|p,a| a + .map_item(|_p,a| a .add_style_back(TerminalStyle::fg_color((0, 100, 20)))) ); b.push( make_label(".") - .map_item(|p,a| a + .map_item(|_p,a| a .add_style_back(TerminalStyle::bold(true)) .add_style_back(TerminalStyle::fg_color((120,120,0)))) ); @@ -218,7 +209,7 @@ async fn main() { .to_sequence() .to_grid_horizontal() .flatten() - .map_item(move |p,a| { + .map_item(move |_p,a| { let select = false; if select { a.add_style_back(TerminalStyle::fg_color((60,60,60))) @@ -231,7 +222,7 @@ async fn main() { ]); - let (w, h) = termion::terminal_size().unwrap(); + let (_w, _h) = termion::terminal_size().unwrap(); /* compositor .write() @@ -251,7 +242,7 @@ async fn main() { loop { let ev = term.next_event().await; - let l = portmutex.write().unwrap(); + let _l = portmutex.write().unwrap(); if let TerminalEvent::Resize(new_size) = ev { cur_size.set(new_size);