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 tower_http::trace::TraceLayer;
use crate::state::{SharedState, State};
use crate::state::SharedState;
async fn root() -> &'static str {
"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 tower_http::trace::TraceLayer;
use crate::state::{SharedState, State};
use crate::state::SharedState;
async fn root() -> &'static str {
"Hello, hyperlog!"

View File

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

View File

@ -1,5 +1,6 @@
#![feature(map_try_insert)]
#![feature(fn_traits)]
#![feature(let_chains)]
use std::io::Stdout;
@ -109,52 +110,50 @@ async fn update<'a>(
let mut handle_key_event = |maybe_event| -> anyhow::Result<UpdateConclusion> {
match maybe_event {
Some(Ok(e)) => {
if let Event::Key(key) = e {
if key.kind == KeyEventKind::Press {
let mut cmd = match &app.mode {
app::Mode::View => match key.code {
KeyCode::Enter => app.update(Msg::Interact)?,
KeyCode::Char('l') => app.update(Msg::MoveRight)?,
KeyCode::Char('h') => app.update(Msg::MoveLeft)?,
KeyCode::Char('j') => app.update(Msg::MoveDown)?,
KeyCode::Char('k') => app.update(Msg::MoveUp)?,
KeyCode::Char('a') => {
// TODO: batch commands
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,
if let Event::Key(key) = e
&& key.kind == KeyEventKind::Press
{
let mut cmd = match &app.mode {
app::Mode::View => match key.code {
KeyCode::Enter => app.update(Msg::Interact)?,
KeyCode::Char('l') => app.update(Msg::MoveRight)?,
KeyCode::Char('h') => app.update(Msg::MoveLeft)?,
KeyCode::Char('j') => app.update(Msg::MoveDown)?,
KeyCode::Char('k') => app.update(Msg::MoveUp)?,
KeyCode::Char('a') => {
// TODO: batch commands
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,
}
}
}

View File

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