chore: remove unused functions and fix 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-15 15:10:35 +02:00
parent 7496d0e964
commit 91ad8eda01
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912
6 changed files with 14 additions and 8 deletions

View File

@ -132,7 +132,7 @@ impl Commander {
Ok(()) Ok(())
} }
Command::Move { root, src, dest } => todo!(), Command::Move { .. } => todo!(),
} }
} }
} }

View File

@ -28,13 +28,10 @@ struct ItemContent {
#[derive(sqlx::FromRow)] #[derive(sqlx::FromRow)]
struct Root { struct Root {
id: uuid::Uuid, id: uuid::Uuid,
root_name: String,
} }
#[derive(sqlx::FromRow)] #[derive(sqlx::FromRow)]
struct Section { struct Section {}
id: uuid::Uuid,
}
impl CreateItem { impl CreateItem {
pub fn new(db: sqlx::PgPool) -> Self { pub fn new(db: sqlx::PgPool) -> Self {

View File

@ -14,7 +14,6 @@ pub struct Response {}
#[derive(sqlx::FromRow)] #[derive(sqlx::FromRow)]
struct Root { struct Root {
id: uuid::Uuid, id: uuid::Uuid,
root_name: String,
} }
impl CreateSection { impl CreateSection {

View File

@ -20,7 +20,7 @@ impl GetAvailableRoots {
Self { db } Self { db }
} }
pub async fn execute(&self, req: Request) -> anyhow::Result<Response> { pub async fn execute(&self, _req: Request) -> anyhow::Result<Response> {
let roots: Vec<Root> = sqlx::query_as( let roots: Vec<Root> = sqlx::query_as(
r#" r#"
SELECT SELECT

View File

@ -35,7 +35,6 @@ struct Item {
#[derive(sqlx::FromRow, Debug)] #[derive(sqlx::FromRow, Debug)]
struct Node { struct Node {
id: uuid::Uuid,
path: String, path: String,
item_type: String, item_type: String,
item_content: Option<Json<serde_json::Value>>, item_content: Option<Json<serde_json::Value>>,
@ -152,12 +151,14 @@ mod engine {
} }
impl Engine { impl Engine {
#[allow(dead_code)]
pub fn engine_from_str(input: &str) -> anyhow::Result<Self> { pub fn engine_from_str(input: &str) -> anyhow::Result<Self> {
let graph: Graph = serde_json::from_str(input)?; let graph: Graph = serde_json::from_str(input)?;
Ok(Self { graph }) Ok(Self { graph })
} }
#[allow(dead_code)]
pub fn to_str(&self) -> anyhow::Result<String> { pub fn to_str(&self) -> anyhow::Result<String> {
serde_json::to_string_pretty(&self.graph).context("failed to serialize graph") serde_json::to_string_pretty(&self.graph).context("failed to serialize graph")
} }
@ -219,18 +220,21 @@ mod engine {
root.get(path) root.get(path)
} }
#[allow(dead_code)]
pub fn get_mut(&mut self, root: &str, path: &[&str]) -> Option<&mut GraphItem> { pub fn get_mut(&mut self, root: &str, path: &[&str]) -> Option<&mut GraphItem> {
let root = self.graph.get_mut(root)?; let root = self.graph.get_mut(root)?;
root.get_mut(path) root.get_mut(path)
} }
#[allow(dead_code)]
pub fn take(&mut self, root: &str, path: &[&str]) -> Option<GraphItem> { pub fn take(&mut self, root: &str, path: &[&str]) -> Option<GraphItem> {
let root = self.graph.get_mut(root)?; let root = self.graph.get_mut(root)?;
root.take(path) root.take(path)
} }
#[allow(dead_code)]
pub fn section_move( pub fn section_move(
&mut self, &mut self,
root: &str, root: &str,
@ -268,12 +272,14 @@ mod engine {
Ok(()) Ok(())
} }
#[allow(dead_code)]
pub fn delete(&mut self, root: &str, path: &[&str]) -> anyhow::Result<()> { pub fn delete(&mut self, root: &str, path: &[&str]) -> anyhow::Result<()> {
self.take(root, path) self.take(root, path)
.map(|_| ()) .map(|_| ())
.ok_or(anyhow!("item was not found")) .ok_or(anyhow!("item was not found"))
} }
#[allow(dead_code)]
pub fn toggle_item(&mut self, root: &str, path: &[&str]) -> anyhow::Result<()> { pub fn toggle_item(&mut self, root: &str, path: &[&str]) -> anyhow::Result<()> {
if let Some(item) = self.get_mut(root, path) { if let Some(item) = self.get_mut(root, path) {
match item { match item {
@ -290,6 +296,7 @@ mod engine {
Ok(()) Ok(())
} }
#[allow(dead_code)]
pub fn update_item( pub fn update_item(
&mut self, &mut self,
root: &str, root: &str,
@ -341,6 +348,7 @@ mod engine {
Ok(()) Ok(())
} }
#[allow(dead_code)]
pub fn get_roots(&self) -> Option<Vec<String>> { pub fn get_roots(&self) -> Option<Vec<String>> {
let items = self.graph.keys().cloned().collect::<Vec<_>>(); let items = self.graph.keys().cloned().collect::<Vec<_>>();
if items.is_empty() { if items.is_empty() {

View File

@ -1,3 +1,5 @@
use std::net::SocketAddr;
use clap::{Parser, Subcommand, ValueEnum}; use clap::{Parser, Subcommand, ValueEnum};
use hyperlog_tui::{ use hyperlog_tui::{
commander, commander,