@@ -98,7 +98,7 @@ impl App {
9898 frame. render_widget ( self . state_bar ( ) , bottom) ;
9999 }
100100
101- fn sess_list ( & self ) -> List {
101+ fn sess_list ( & self ) -> List < ' _ > {
102102 let mut title = Line :: from ( "sessions" ) . bold ( ) ;
103103 if self . focus . select ( ) {
104104 title = title. fg ( Color :: Black ) . bg ( Color :: LightBlue ) ;
@@ -144,17 +144,17 @@ impl App {
144144 text. push_str ( msg) ;
145145 text. push ( '\n' )
146146 }
147- if let State :: User = self . state ( ) {
148- if let Focus :: Main ( cursor) = & mut self . focus {
149- let time = Instant :: now ( ) ;
150- let duration = time . duration_since ( * cursor ) ;
151- if duration < Duration :: from_millis ( 500 ) {
152- } else if duration < Duration :: from_secs ( 1 ) {
153- text . pop ( ) ;
154- text. push ( '_' )
155- } else {
156- * cursor = time
157- }
147+ if let State :: User = self . state ( )
148+ && let Focus :: Main ( cursor) = & mut self . focus
149+ {
150+ let time = Instant :: now ( ) ;
151+ let duration = time . duration_since ( * cursor ) ;
152+ if duration < Duration :: from_millis ( 500 ) {
153+ } else if duration < Duration :: from_secs ( 1 ) {
154+ text. pop ( ) ;
155+ text . push ( '_' )
156+ } else {
157+ * cursor = time
158158 }
159159 }
160160
@@ -182,7 +182,7 @@ impl App {
182182 frame. render_stateful_widget ( scrollbar, area, & mut scrollbar_state) ;
183183 }
184184
185- fn state_bar ( & self ) -> Paragraph {
185+ fn state_bar ( & self ) -> Paragraph < ' _ > {
186186 let title = Line :: from ( "state" ) . bold ( ) . blue ( ) ;
187187 let text = format ! (
188188 "msgs: {}, pos: {}/{}/{}" ,
@@ -199,12 +199,11 @@ impl App {
199199 State :: User => Duration :: from_millis ( 250 ) ,
200200 State :: Assistant => Duration :: from_millis ( 5 ) ,
201201 } ;
202- if event:: poll ( interval) ? {
203- if let Event :: Key ( key) = event:: read ( ) ? {
204- if key. kind == KeyEventKind :: Press {
205- self . on_key_event ( key)
206- }
207- }
202+ if event:: poll ( interval) ?
203+ && let Event :: Key ( key) = event:: read ( ) ?
204+ && key. kind == KeyEventKind :: Press
205+ {
206+ self . on_key_event ( key)
208207 }
209208 Ok ( ( ) )
210209 }
0 commit comments