Skip to content

refactor: prefix unused variable names, remove unused imports #153

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

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 2 additions & 3 deletions helix-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1020,12 +1020,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 @@ -1176,7 +1175,7 @@ fn main() {

#[cfg(not(target_os = "macos"))]
{
if let Err(e) = open::that("https://helix-db.com/dashboard") {
if let Err(_e) = open::that("https://helix-db.com/dashboard") {
println!("Failed to open url");
println!("Please visit https://helix-db.com/dashboard");
}
Expand Down
8 changes: 4 additions & 4 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
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
22 changes: 2 additions & 20 deletions helixdb/src/helix_engine/graph_core/graph_core.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
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 @@ -94,7 +76,7 @@ impl HelixGraphEngine {
// json_string
// }

pub fn query(&self, query: String, params: Vec<QueryInput>) -> Result<String, GraphError> {
pub fn query(&self, _query: String, _params: Vec<QueryInput>) -> Result<String, GraphError> {
Ok(String::new())
}
// let ast: Source = match HelixParser::parse_source(query.as_str()) {
Expand Down
6 changes: 3 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,10 @@ 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,
vector_core::hnsw::HNSW,
};
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
14 changes: 7 additions & 7 deletions helixdb/src/helix_engine/graph_core/ops/source/bulk_add_e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub trait BulkAddEAdapter<'a, 'b>: Iterator<Item = Result<TraversalVal, GraphErr
self,
edges: Vec<(u128, u128, u128)>,
should_check_nodes: bool,
chunk_size: usize,
_chunk_size: usize,
) -> RwTraversalIterator<'a, 'b, impl Iterator<Item = Result<TraversalVal, GraphError>>>;
}

Expand Down Expand Up @@ -100,11 +100,11 @@ impl<'a, 'b, I: Iterator<Item = Result<TraversalVal, GraphError>>> BulkAddEAdapt
// OUT EDGES
let mut prev_out = None;

edges.sort_unstable_by(|(from, to, id), (from_, to_, id_)| {
if from == from_ {
edges.sort_unstable_by(|(_from, _to, id), (_from_, _to_, id_)| {
if _from == _from_ {
id.cmp(id_)
} else {
from.cmp(from_)
_from.cmp(_from_)
}
});

Expand Down Expand Up @@ -140,11 +140,11 @@ impl<'a, 'b, I: Iterator<Item = Result<TraversalVal, GraphError>>> BulkAddEAdapt
println!("Adding in edges");
// IN EDGES
edges.sort_unstable_by(
|(from, to, id), (from_, to_, id_)| {
if to == to_ {
|(_from, _to, id), (_from_, _to_, id_)| {
if _to == _to_ {
id.cmp(id_)
} else {
to.cmp(to_)
_to.cmp(_to_)
}
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl<'a, 'b, I: Iterator<Item = Result<TraversalVal, GraphError>>> BulkAddNAdapt
let mut result: Result<TraversalVal, GraphError> = Ok(TraversalVal::Empty);
nodes.sort_unstable_by_key(|node| *node);
let chunks = nodes.chunks_mut(chunk_size);
let secondary_indices = secondary_indices.unwrap_or(&[]).to_vec();
let _secondary_indices = secondary_indices.unwrap_or(&[]).to_vec();
let mut count = 0;
for chunk in chunks {
for node in chunk {
Expand Down
2 changes: 1 addition & 1 deletion helixdb/src/helix_engine/graph_core/ops/tr_val.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl Traversable for TraversalVal {
TraversalVal::Edge(edge) => edge.id,

TraversalVal::Vector(vector) => vector.id,
TraversalVal::Value(value) => unreachable!(),
TraversalVal::Value(_value) => unreachable!(),
TraversalVal::Empty => 0,
t => {
println!("invalid traversal value {:?}", t);
Expand Down
2 changes: 1 addition & 1 deletion helixdb/src/helix_engine/graph_core/ops/vectors/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub trait InsertVAdapter<'a, 'b>: Iterator<Item = Result<TraversalVal, GraphErro
fn insert_v<F>(
self,
vec: &Vec<f64>,
label: &str,
_label: &str,
fields: Option<Vec<(String, Value)>>,
) -> RwTraversalIterator<'a, 'b, impl Iterator<Item = Result<TraversalVal, GraphError>>>
where
Expand Down
27 changes: 12 additions & 15 deletions helixdb/src/helix_engine/graph_core/traversal_tests.rs
Original file line number Diff line number Diff line change
@@ -1,41 +1,38 @@
use std::{sync::Arc, time::Instant};

use crate::{
helix_engine::graph_core::ops::source::{
bulk_add_e::BulkAddEAdapter, e_from_type::EFromTypeAdapter,
helix_engine::graph_core::ops::{
source::e_from_type::EFromTypeAdapter,
util::drop::Drop,
},
props,
};
use crate::{
helix_engine::graph_core::ops::source::{
n_from_index::NFromIndexAdapter, n_from_type::NFromTypeAdapter,
helix_engine::graph_core::ops::{
source::n_from_type::NFromTypeAdapter,
util::paths::ShortestPathAdapter,
},
protocol::{
filterable::Filterable,
id::ID,
items::{Edge, Node},
traversal_value::TraversalValue,
value::Value,
},
};
use crate::{
helix_engine::{
use crate::helix_engine::{
graph_core::ops::{
g::G,
in_::{in_e::InEdgesAdapter, to_n::ToNAdapter},
out::{from_n::FromNAdapter, out::OutAdapter},
source::{
add_n::AddNAdapter, bulk_add_n::BulkAddNAdapter, e_from_id::EFromIdAdapter,
add_n::AddNAdapter, e_from_id::EFromIdAdapter,
n_from_id::NFromIdAdapter,
},
tr_val::{Traversable, TraversalVal},
util::{dedup::DedupAdapter, range::RangeAdapter},
},
storage_core::{storage_core::HelixGraphStorage, storage_methods::StorageMethods},
storage_core::storage_core::HelixGraphStorage,
types::GraphError,
},
protocol::items::v6_uuid,
};
};
use rand::Rng;
use serde::{Deserialize, Serialize};
use tempfile::TempDir;
Expand Down Expand Up @@ -167,7 +164,7 @@ fn test_out() {
.collect_to::<Vec<_>>();

txn.commit().unwrap();
let mut txn = storage.graph_env.write_txn().unwrap();
let txn = storage.graph_env.write_txn().unwrap();

// let nodes = VFromId::new(&storage, &txn, person1.id.as_str())
// .out("knows")
Expand Down Expand Up @@ -1276,7 +1273,7 @@ fn huge_traversal() {
let (storage, _temp_dir) = setup_test_db();
let mut txn = storage.graph_env.write_txn().unwrap();

let mut start = Instant::now();
let start = Instant::now();
let mut nodes = Vec::with_capacity(1000_000);
for i in 0..1000_000 {
let id = G::new_mut(Arc::clone(&storage), &mut txn).add_n(
Expand Down
3 changes: 1 addition & 2 deletions helixdb/src/helix_engine/storage_core/storage_core.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
helix_engine::{
bm25::bm25::{HBM25Config, BM25},
bm25::bm25::HBM25Config,
graph_core::config::Config,
storage_core::storage_methods::StorageMethods,
types::GraphError,
Expand All @@ -14,7 +14,6 @@ use crate::{
filterable::Filterable,
items::{Edge, Node},
label_hash::hash_label,
value::Value,
},
};

Expand Down
5 changes: 1 addition & 4 deletions helixdb/src/helix_engine/storage_core/storage_methods.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use crate::helix_engine::types::GraphError;
use crate::protocol::{
items::{Edge, Node},
value::Value,
};
use crate::protocol::items::{Edge, Node};
use heed3::{RoTxn, RwTxn};

pub trait DBMethods {
Expand Down
1 change: 0 additions & 1 deletion helixdb/src/helix_engine/vector_core/hnsw.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::collections::HashMap;

use crate::{helix_engine::types::VectorError, protocol::value::Value};
use crate::helix_engine::vector_core::vector::HVector;
Expand Down
2 changes: 1 addition & 1 deletion helixdb/src/helix_engine/vector_core/vector_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ impl HNSW for VectorCore {
with_data: bool,
) -> Result<HVector, VectorError> {
let key = Self::vector_key(id, level);
let mut vector = match self.vectors_db.get(txn, key.as_ref())? {
let vector = match self.vectors_db.get(txn, key.as_ref())? {
Some(bytes) => {
let vector = match with_data {
true => HVector::from_bytes(id, level, &bytes),
Expand Down
2 changes: 1 addition & 1 deletion helixdb/src/helix_gateway/connection/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl ConnectionHandler {

let active_connections = Arc::clone(&self.active_connections);
let thread_pool_sender = self.thread_pool.sender.clone();
let address = self.address.clone();
let _address = self.address.clone();


let handle = tokio::spawn(async move {
Expand Down
15 changes: 6 additions & 9 deletions helixdb/src/helixc/analyzer/analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ use crate::{
bool_op::{BoolOp, Eq, Gt, Gte, Lt, Lte, Neq},
generator_types::{
Assignment as GeneratedAssignment, BoExp, Drop as GeneratedDrop,
ForEach as GeneratedForEach, ForLoopInVariable, ForVariable, IdentifierType,
ForEach as GeneratedForEach, ForLoopInVariable, ForVariable,
Parameter as GeneratedParameter, Query as GeneratedQuery, ReturnValue,
ReturnValueExpr, Source as GeneratedSource, Statement as GeneratedStatement,
},
object_remapping_generation::{
ExcludeField, FieldRemapping, IdentifierRemapping, ObjectRemapping, Remapping,
ExcludeField, IdentifierRemapping, ObjectRemapping, Remapping,
RemappingType, TraversalRemapping, ValueRemapping,
},
source_steps::{
Expand All @@ -27,21 +27,18 @@ use crate::{
Traversal as GeneratedTraversal, TraversalType, Where, WhereExists, WhereRef,
},
utils::{
GenRef, GeneratedType, GeneratedValue, RustType as GeneratedRustType, Separator,
GenRef, GeneratedValue, Separator,
},
},
parser::{
helix_parser::{ShortestPath, *},
helix_parser::*,
location::Loc,
},
},
protocol::{date::Date, value::Value},
};

use std::{
collections::{HashMap, HashSet},
ops::{ControlFlow, Deref},
};
use std::collections::{HashMap, HashSet};

use super::{fix::Fix, pretty};

Expand Down Expand Up @@ -3007,7 +3004,7 @@ impl<'a> Ctx<'a> {
new_value: inner_traversal,
})
}
ExpressionType::Exists(exists) => {
ExpressionType::Exists(_exists) => {
todo!()
}
ExpressionType::BooleanLiteral(bo_lit) => {
Expand Down
8 changes: 3 additions & 5 deletions helixdb/src/helixc/analyzer/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ use std::collections::HashMap;
use crate::helixc::{
generator::{
generator_types::{
Assignment as GeneratedAssignment, EdgeSchema as GeneratedEdgeSchema,
NodeSchema as GeneratedNodeSchema, Parameter as GeneratedParameter, SchemaProperty,
Statement as GeneratedStatement, VectorSchema as GeneratedVectorSchema,
EdgeSchema as GeneratedEdgeSchema,
NodeSchema as GeneratedNodeSchema, Parameter as GeneratedParameter, SchemaProperty, VectorSchema as GeneratedVectorSchema,
},
traversal_steps::Traversal as GeneratedTraversal,
utils::{GenRef, GeneratedType, GeneratedValue, RustType as GeneratedRustType},
},
parser::helix_parser::{
Assignment, DefaultValue, EdgeSchema, FieldPrefix, FieldType, NodeSchema, Parameter,
DefaultValue, EdgeSchema, FieldType, NodeSchema, Parameter,
VectorSchema,
},
};
Expand Down
2 changes: 1 addition & 1 deletion helixdb/src/helixc/generator/bool_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl Display for BoolOp {
BoolOp::Lte(lte) => format!("{}", lte),
BoolOp::Eq(eq) => format!("{}", eq),
BoolOp::Neq(neq) => format!("{}", neq),
BoolOp::Contains(cont) => unimplemented!(),
BoolOp::Contains(_cont) => unimplemented!(),
};
write!(f, "map_or(false, |v| *v{})", s)
}
Expand Down
Loading