Skip to content

Fix all build warnings both in the main code and tests #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
[workspace]
members = ["helixdb", "helix-container", "get_routes", "helix-cli", "hbuild"]
resolver="2"

[workspace.lints.rust]
warnings = "deny"

[profile.release]
strip = "debuginfo"
lto = true
opt-level = "z"
4 changes: 4 additions & 0 deletions get_routes/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[package]
name = "get_routes"
version = "0.1.0"
edition = "2021"

[lints]
workspace = true

[lib]
proc-macro = true
Expand Down
3 changes: 3 additions & 0 deletions hbuild/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "hbuild"
version = "0.1.0"
edition = "2021"

[lints]
workspace = true

[dependencies]
socket2 = "0.5"
helixdb = { path = "../helixdb", features = ["build"] }
Expand Down
7 changes: 3 additions & 4 deletions helix-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "helix-cli"
version = "1.0.89"
edition = "2021"

[lints]
workspace = true

[dependencies]
clap = { version = "4.5.37", features = ["derive"] }
helixdb = { path = "../helixdb", features = ["full"] }
Expand All @@ -24,10 +27,6 @@ serde_json = "1.0"
[target.'cfg(windows)'.dependencies]
windows = { version = "0.61.1", features = ["Win32_System_Threading", "Win32_Foundation"] }

[profile.release]
lto = true
strip = true

[[bin]]
name = "helix"
path = "src/main.rs"
4 changes: 2 additions & 2 deletions helix-cli/src/instance_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl InstanceManager {

let mut instances = self.list_instances()?;
instances.push(instance.clone());
let _ = self.save_instances(&instances);
self.save_instances(&instances).map_err(|e| io::Error::new(io::ErrorKind::Other, e.to_string()))?;

Ok(instance)
}
Expand Down Expand Up @@ -210,7 +210,7 @@ impl InstanceManager {
unsafe { TerminateProcess(handle, 0) };
}
}
let _ = self.save_instances(&instances)?;
self.save_instances(&instances)?;
return Ok(true);
}
Ok(false)
Expand Down
17 changes: 7 additions & 10 deletions helix-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
};
use helixdb::{
helix_engine::graph_core::config::Config,
ingestion_engine::{postgres_ingestion::PostgresIngestor, sql_ingestion::SqliteIngestor},
ingestion_engine::postgres_ingestion::PostgresIngestor,
};
use std::{
fmt::Write,
Expand Down Expand Up @@ -179,8 +179,7 @@ fn main() {
runner
.arg("build")
.arg("--release")
.current_dir(PathBuf::from(&output))
.env("RUSTFLAGS", "-Awarnings");
.current_dir(PathBuf::from(&output));

match runner.output() {
Ok(output) => {
Expand Down Expand Up @@ -494,8 +493,7 @@ fn main() {
runner
.arg("build")
.arg("--release")
.current_dir(PathBuf::from(&output))
.env("RUSTFLAGS", "-Awarnings");
.current_dir(PathBuf::from(&output));

match runner.output() {
Ok(output) => {
Expand Down Expand Up @@ -917,7 +915,7 @@ fn main() {
};
let path_str = path.to_str().unwrap();

let _ = match check_and_read_files(path_str) {
match check_and_read_files(path_str) {
Ok(files) if !files.is_empty() => {
println!(
"{} {}",
Expand Down Expand Up @@ -1020,12 +1018,11 @@ fn main() {
Err(e) => println!("{} {}", "Error while stopping instance".red().bold(), e),
}

let mut del_prompt: bool = false;
print!("Are you sure you want to delete the instance and its data? (y/n): ");
std::io::stdout().flush().unwrap();
let mut input = String::new();
std::io::stdin().read_line(&mut input).unwrap();
del_prompt = input.trim().to_lowercase() == "y";
let del_prompt = input.trim().to_lowercase() == "y";

if del_prompt {
match instance_manager.delete_instance(iid) {
Expand Down Expand Up @@ -1119,8 +1116,8 @@ fn main() {
}
}

let _ingestor = SqliteIngestor::new(&path_str, None, 5).unwrap();
// TODO: Add ingestion logic
// SqliteIngestor::new(&path_str, None, 5).unwrap();
}
"pg" | "postgres" => {
let mut sp = Spinner::new(
Expand All @@ -1142,7 +1139,7 @@ fn main() {

// Run the PostgreSQL ingestion
let rt = tokio::runtime::Runtime::new().unwrap();
let _result = rt.block_on(async {
rt.block_on(async {
let ingestor = PostgresIngestor::new(&command.db_url, Some(command.instance.clone()), command.batch_size, command.use_ssl).await;

match ingestor {
Expand Down
26 changes: 0 additions & 26 deletions helix-cli/src/styled_string.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
#[allow(dead_code)]
pub trait StyledString {
fn black(&self) -> String;
fn red(&self) -> String;
fn green(&self) -> String;
fn yellow(&self) -> String;
fn blue(&self) -> String;
fn magenta(&self) -> String;
fn cyan(&self) -> String;
fn white(&self) -> String;
fn bold(&self) -> String;
fn underline(&self) -> String;
}

impl StyledString for str {
fn black(&self) -> String {
format!("\x1b[30m{}\x1b[0m", self)
}

fn red(&self) -> String {
format!("\x1b[31m{}\x1b[0m", self)
}
Expand All @@ -29,22 +19,6 @@ impl StyledString for str {
format!("\x1b[33m{}\x1b[0m", self)
}

fn blue(&self) -> String {
format!("\x1b[34m{}\x1b[0m", self)
}

fn magenta(&self) -> String {
format!("\x1b[35m{}\x1b[0m", self)
}

fn cyan(&self) -> String {
format!("\x1b[36m{}\x1b[0m", self)
}

fn white(&self) -> String {
format!("\x1b[37m{}\x1b[0m", self)
}

fn bold(&self) -> String {
format!("\x1b[1m{}\x1b[0m", self)
}
Expand Down
2 changes: 0 additions & 2 deletions helix-cli/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use std::{
pub enum CliError {
Io(std::io::Error),
New(String),
ConfigFileNotFound,
CompileFailed,
}

Expand All @@ -16,7 +15,6 @@ impl std::fmt::Display for CliError {
match self {
CliError::Io(e) => write!(f, "IO error: {}", e),
CliError::New(msg) => write!(f, "{}", msg),
CliError::ConfigFileNotFound => write!(f, "Config file not found"),
CliError::CompileFailed => write!(f, "Failed to compile queries"),
}
}
Expand Down
10 changes: 4 additions & 6 deletions helix-container/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "helix-container"
version = "0.1.0"
edition = "2021"

[lints]
workspace = true

[dependencies]
helixdb = { path = "../helixdb" }
get_routes = { path = "../get_routes" }
Expand All @@ -15,9 +18,4 @@ sonic-rs = "0.5.0"
tokio = { version = "1.44.2", features = ["full"] }
serde_json = "1.0.140"
uuid = { version = "1.12.1", features = ["std", "v4", "v6", "fast-rng"] }
heed3 = "0.22.0"
[profile.release]
strip = "debuginfo"
lto = true
opt-level = "z"

heed3 = "0.22.0"
2 changes: 1 addition & 1 deletion helix-container/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async fn main() {
// start server
println!("Starting server...");
let a = gateway.connection_handler.accept_conns().await.unwrap();
let b = a.await.unwrap();
a.await.unwrap();

}

7 changes: 3 additions & 4 deletions helixdb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ license = "GPL-3.0"
authors = ["HelixDB Team"]
repository = "https://github.com/HelixDB/helix-db"

[lints]
workspace = true

[dependencies]
tokio = { version = "1.44.2", features = ["full"] }
serde = { version = "1.0.217", features = ["derive"] }
Expand Down Expand Up @@ -69,7 +72,3 @@ build = ["compiler"]
full = ["build", "compiler", "ingestion", "cosine"]
default = ["full"]

[profile.release]
strip = "debuginfo"
lto = true
opt-level = "z"
12 changes: 6 additions & 6 deletions helixdb/src/helix_engine/bm25/bm25.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use heed3::{types::*, Database, Env, RoTxn, RwTxn};
use serde::{Deserialize, Serialize};
use std::{borrow::Cow, collections::HashMap, sync::Arc};
use std::{borrow::Cow, collections::HashMap};

use crate::{
helix_engine::{
storage_core::{storage_core::HelixGraphStorage, storage_methods::StorageMethods},
storage_core::storage_core::HelixGraphStorage,
types::GraphError,
vector_core::{hnsw::HNSW, vector::HVector},
},
Expand Down Expand Up @@ -43,8 +43,8 @@ pub trait BM25 {
) -> Result<Vec<(u128, f32)>, GraphError>;
fn calculate_bm25_score(
&self,
term: &str,
doc_id: u128,
_term: &str,
_doc_id: u128,
tf: u32,
doc_length: u32,
df: u32,
Expand Down Expand Up @@ -308,8 +308,8 @@ impl BM25 for HBM25Config {

fn calculate_bm25_score(
&self,
term: &str,
doc_id: u128,
_term: &str,
_doc_id: u128,
tf: u32,
doc_length: u32,
df: u32,
Expand Down
2 changes: 1 addition & 1 deletion helixdb/src/helix_engine/bm25/bm25_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#[cfg(test)]
mod tests {
use crate::helix_engine::bm25::bm25::{BM25, HBM25Config, HybridSearch, BM25Metadata, PostingListEntry};
use crate::helix_engine::bm25::bm25::{BM25, HBM25Config, HybridSearch, BM25Metadata};
use crate::helix_engine::{
storage_core::storage_core::HelixGraphStorage,
graph_core::config::Config,
Expand Down
24 changes: 5 additions & 19 deletions helixdb/src/helix_engine/graph_core/graph_core.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
use crate::helix_engine::storage_core::storage_core::HelixGraphStorage;
use crate::helix_engine::storage_core::storage_methods::StorageMethods;
use crate::helix_engine::types::GraphError;
use crate::props;
use crate::protocol::filterable::{Filterable, FilterableType};
use crate::protocol::remapping::{Remapping, ResponseRemapping};
use std::collections::HashMap;
use std::ops::Deref;
use std::str;
use std::sync::{Arc, RwLock};
use std::sync::Arc;


use super::config::VectorConfig;
use crate::helixc::parser::helix_parser::{
BooleanOp, Expression, GraphStep, HelixParser, IdType, Source, StartNode, Statement, Step,
Traversal,
};
use crate::protocol::traversal_value::TraversalValue;
use crate::protocol::{
items::{Edge, Node},
return_values::ReturnValue,
value::Value,
};

use crate::helix_engine::graph_core::config::Config;

Expand Down Expand Up @@ -95,6 +78,9 @@ impl HelixGraphEngine {
// }

pub fn query(&self, query: String, params: Vec<QueryInput>) -> Result<String, GraphError> {
// TODO: Implement query functionality
let _ = query;
let _ = params;
Ok(String::new())
}
// let ast: Source = match HelixParser::parse_source(query.as_str()) {
Expand Down
5 changes: 2 additions & 3 deletions helixdb/src/helix_engine/graph_core/ops/bm25/search_bm25.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ use crate::helix_engine::{
bm25::bm25::BM25,
graph_core::traversal_iter::RoTraversalIterator,
storage_core::{storage_core::HelixGraphStorage, storage_methods::StorageMethods},
types::{GraphError, VectorError},
vector_core::{hnsw::HNSW, vector::HVector},
types::GraphError,
};
use std::{iter::once, sync::Arc};
use std::sync::Arc;

pub struct SearchBM25<'scope, 'inner> {
txn: &'scope RoTxn<'scope>,
Expand Down
8 changes: 4 additions & 4 deletions helixdb/src/helix_engine/graph_core/ops/source/add_e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ pub trait AddEAdapter<'a, 'b>: Iterator<Item = Result<TraversalVal, GraphError>>
properties: Option<Vec<(String, Value)>>,
from_node: u128,
to_node: u128,
should_check: bool,
edge_type: EdgeType,
_should_check: bool,
_edge_type: EdgeType,
) -> RwTraversalIterator<'a, 'b, impl Iterator<Item = Result<TraversalVal, GraphError>>>;

fn node_vec_exists(&self, node_vec_id: &u128, edge_type: EdgeType) -> bool;
Expand All @@ -62,9 +62,9 @@ impl<'a, 'b, I: Iterator<Item = Result<TraversalVal, GraphError>>> AddEAdapter<'
properties: Option<Vec<(String, Value)>>,
from_node: u128,
to_node: u128,
should_check: bool,
_should_check: bool,
// edge_types: (EdgeType, EdgeType),
edge_type: EdgeType,
_edge_type: EdgeType,
) -> RwTraversalIterator<'a, 'b, impl Iterator<Item = Result<TraversalVal, GraphError>>> {
let edge = Edge {
id: v6_uuid(),
Expand Down
Loading