chore: remove warnings
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2024-05-12 14:38:03 +02:00
parent 874045dca8
commit 9cb3296cec
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912
5 changed files with 50 additions and 50 deletions

View File

@ -3,7 +3,7 @@ use std::net::SocketAddr;
use axum::{extract::MatchedPath, http::Request, routing::get, Router}; use axum::{extract::MatchedPath, http::Request, routing::get, Router};
use tower_http::trace::TraceLayer; use tower_http::trace::TraceLayer;
use crate::state::{SharedState, State}; use crate::state::SharedState;
async fn root() -> &'static str { async fn root() -> &'static str {
"Hello, hyperlog!" "Hello, hyperlog!"

View File

@ -1,9 +1,9 @@
use std::{net::SocketAddr, sync::Arc}; use std::net::SocketAddr;
use axum::{extract::MatchedPath, http::Request, routing::get, Router}; use axum::{extract::MatchedPath, http::Request, routing::get, Router};
use tower_http::trace::TraceLayer; use tower_http::trace::TraceLayer;
use crate::state::{SharedState, State}; use crate::state::SharedState;
async fn root() -> &'static str { async fn root() -> &'static str {
"Hello, hyperlog!" "Hello, hyperlog!"

View File

@ -4,6 +4,7 @@ use crate::state::SharedState;
pub struct Querier {} pub struct Querier {}
#[allow(dead_code, unused_variables)]
impl Querier { impl Querier {
pub fn new() -> Self { pub fn new() -> Self {
Self {} Self {}

View File

@ -1,5 +1,6 @@
#![feature(map_try_insert)] #![feature(map_try_insert)]
#![feature(fn_traits)] #![feature(fn_traits)]
#![feature(let_chains)]
use std::io::Stdout; use std::io::Stdout;
@ -109,52 +110,50 @@ async fn update<'a>(
let mut handle_key_event = |maybe_event| -> anyhow::Result<UpdateConclusion> { let mut handle_key_event = |maybe_event| -> anyhow::Result<UpdateConclusion> {
match maybe_event { match maybe_event {
Some(Ok(e)) => { Some(Ok(e)) => {
if let Event::Key(key) = e { if let Event::Key(key) = e
if key.kind == KeyEventKind::Press { && key.kind == KeyEventKind::Press
let mut cmd = match &app.mode { {
app::Mode::View => match key.code { let mut cmd = match &app.mode {
KeyCode::Enter => app.update(Msg::Interact)?, app::Mode::View => match key.code {
KeyCode::Char('l') => app.update(Msg::MoveRight)?, KeyCode::Enter => app.update(Msg::Interact)?,
KeyCode::Char('h') => app.update(Msg::MoveLeft)?, KeyCode::Char('l') => app.update(Msg::MoveRight)?,
KeyCode::Char('j') => app.update(Msg::MoveDown)?, KeyCode::Char('h') => app.update(Msg::MoveLeft)?,
KeyCode::Char('k') => app.update(Msg::MoveUp)?, KeyCode::Char('j') => app.update(Msg::MoveDown)?,
KeyCode::Char('a') => { KeyCode::Char('k') => app.update(Msg::MoveUp)?,
// TODO: batch commands KeyCode::Char('a') => {
app.update(Msg::OpenCreateItemDialog)?; // TODO: batch commands
app.update(Msg::EnterInsertMode)? app.update(Msg::OpenCreateItemDialog)?;
} app.update(Msg::EnterInsertMode)?
KeyCode::Char('i') => app.update(Msg::EnterInsertMode)?,
KeyCode::Char(':') => app.update(Msg::EnterCommandMode)?,
_ => return Ok(UpdateConclusion(false)),
},
app::Mode::Command | app::Mode::Insert => match key.code {
KeyCode::Backspace => app.update(Msg::Edit(EditMsg::Delete))?,
KeyCode::Enter => app.update(Msg::Edit(EditMsg::InsertNewLine))?,
KeyCode::Tab => app.update(Msg::Edit(EditMsg::InsertTab))?,
KeyCode::Delete => app.update(Msg::Edit(EditMsg::DeleteNext))?,
KeyCode::Char(c) => {
app.update(Msg::Edit(EditMsg::InsertChar(c)))?
}
KeyCode::Left => app.update(Msg::Edit(EditMsg::MoveLeft))?,
KeyCode::Right => app.update(Msg::Edit(EditMsg::MoveRight))?,
KeyCode::Esc => app.update(Msg::EnterViewMode)?,
_ => return Ok(UpdateConclusion(false)),
},
};
loop {
let msg = cmd.into_command().execute(dispatch.clone());
match msg {
Some(msg) => {
if let Msg::QuitApp = msg {
return Ok(UpdateConclusion(true));
}
cmd = app.update(msg)?;
}
None => break,
} }
KeyCode::Char('i') => app.update(Msg::EnterInsertMode)?,
KeyCode::Char(':') => app.update(Msg::EnterCommandMode)?,
_ => return Ok(UpdateConclusion(false)),
},
app::Mode::Command | app::Mode::Insert => match key.code {
KeyCode::Backspace => app.update(Msg::Edit(EditMsg::Delete))?,
KeyCode::Enter => app.update(Msg::Edit(EditMsg::InsertNewLine))?,
KeyCode::Tab => app.update(Msg::Edit(EditMsg::InsertTab))?,
KeyCode::Delete => app.update(Msg::Edit(EditMsg::DeleteNext))?,
KeyCode::Char(c) => app.update(Msg::Edit(EditMsg::InsertChar(c)))?,
KeyCode::Left => app.update(Msg::Edit(EditMsg::MoveLeft))?,
KeyCode::Right => app.update(Msg::Edit(EditMsg::MoveRight))?,
KeyCode::Esc => app.update(Msg::EnterViewMode)?,
_ => return Ok(UpdateConclusion(false)),
},
};
loop {
let msg = cmd.into_command().execute(dispatch.clone());
match msg {
Some(msg) => {
if let Msg::QuitApp = msg {
return Ok(UpdateConclusion(true));
}
cmd = app.update(msg)?;
}
None => break,
} }
} }
} }

View File

@ -5,12 +5,12 @@ use hyperlog_protos::hyperlog::{graph_client::GraphClient, graph_item::Contents,
use itertools::Itertools; use itertools::Itertools;
use tonic::transport::Channel; use tonic::transport::Channel;
use crate::shared_engine::SharedEngine; #[allow(dead_code)]
pub struct Querier { pub struct Querier {
channel: Channel, channel: Channel,
} }
#[allow(dead_code, unused_variables)]
impl Querier { impl Querier {
pub async fn new() -> anyhow::Result<Self> { pub async fn new() -> anyhow::Result<Self> {
let channel = Channel::from_static("http://localhost:4000") let channel = Channel::from_static("http://localhost:4000")