Skip to content

Commit

Permalink
chore: fix wanrings
Browse files Browse the repository at this point in the history
  • Loading branch information
ImJeremyHe committed Apr 18, 2022
1 parent b94130a commit 082e5fd
Show file tree
Hide file tree
Showing 26 changed files with 43 additions and 448 deletions.
2 changes: 1 addition & 1 deletion crates/controller/lexer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub fn lex(s: &str) -> Option<pest::iterators::Pair<Rule>> {
let tokens = r.next().unwrap();
Some(tokens)
}
Err(e) => None,
Err(_e) => None,
}
}

Expand Down
2 changes: 2 additions & 0 deletions crates/controller/parser/src/climber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use pest::iterators::Pair;
use pest::RuleType;

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[allow(dead_code)]
pub enum Assoc {
Prefix,
Left,
Expand All @@ -13,6 +14,7 @@ pub enum Assoc {
}

#[derive(Debug)]
#[allow(dead_code)]
pub struct Operator<R: RuleType> {
rule: R,
assoc: Assoc,
Expand Down
56 changes: 0 additions & 56 deletions crates/controller/src/addr_parser.rs

This file was deleted.

33 changes: 0 additions & 33 deletions crates/controller/src/calc_engine/calculator/calc_vertex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,6 @@ pub enum CalcVertex {
}

impl CalcVertex {
pub fn get_sheet_id(&self) -> Option<SheetId> {
match self {
CalcVertex::Value(_) => None,
CalcVertex::Reference(r) => Some(r.sheet),
CalcVertex::Union(u) => {
let sheet_id = u.get(0)?.as_ref().get_sheet_id()?;
Some(sheet_id)
}
}
}

pub fn get_addr(&self) -> Option<Addr> {
match self {
CalcVertex::Value(_) => None,
CalcVertex::Reference(r) => match &r.reference {
Reference::Addr(addr) => Some(*addr),
Reference::ColumnRange(cr) => Some(Addr {
row: 0,
col: cr.start,
}),
Reference::RowRange(rr) => Some(Addr {
row: rr.start,
col: 0,
}),
Reference::Range(range) => Some(range.start),
},
CalcVertex::Union(u) => {
let addr = u.get(0)?.as_ref().get_addr()?;
Some(addr)
}
}
}

pub fn from_error(e: ast::Error) -> Self {
CalcVertex::Value(CalcValue::Scalar(Value::Error(e)))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ fn _index(cv: CalcVertex, r: usize, c: usize) -> CalcVertex {
CalcValue::Cube(_) => CalcVertex::from_error(ast::Error::Value),
CalcValue::Union(_) => unreachable!(),
},
CalcVertex::Reference(r) => todo!(),
CalcVertex::Reference(_) => todo!(),
CalcVertex::Union(_) => unreachable!(),
}
}
Expand Down
33 changes: 13 additions & 20 deletions crates/controller/src/calc_engine/calculator/funcs/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,6 @@ pub fn convert_f64(value: Value) -> Result<f64, ast::Error> {
}
}

pub fn assert_scalar_value(v: CalcValue) -> Option<Value> {
match v {
CalcValue::Scalar(v) => Some(v),
_ => None,
}
}

pub fn is_error(value: &CalcValue) -> bool {
match value {
CalcValue::Scalar(s) => match s {
Expand Down Expand Up @@ -92,9 +85,9 @@ pub mod tests_utils {
impl AsyncFuncCommitTrait for TestFetcher {
fn query_or_commit_task(
&mut self,
sheet_id: logisheets_base::SheetId,
cell_id: logisheets_base::CellId,
task: Task,
_sheet_id: logisheets_base::SheetId,
_cell_id: logisheets_base::CellId,
_task: Task,
) -> Option<AsyncCalcResult> {
None
}
Expand All @@ -114,8 +107,8 @@ pub mod tests_utils {
impl SetCurrCellTrait for TestFetcher {
fn set_curr_cell(
&mut self,
active_sheet: logisheets_base::SheetId,
addr: logisheets_base::Addr,
_active_sheet: logisheets_base::SheetId,
_addr: logisheets_base::Addr,
) {
todo!()
}
Expand Down Expand Up @@ -144,30 +137,30 @@ pub mod tests_utils {

fn get_cell_idx(
&mut self,
sheet_id: logisheets_base::SheetId,
cell_id: &logisheets_base::CellId,
_sheet_id: logisheets_base::SheetId,
_cell_id: &logisheets_base::CellId,
) -> Option<(usize, usize)> {
Some((0, 0))
}

fn get_cell_id(
&mut self,
sheet_id: logisheets_base::SheetId,
row: usize,
col: usize,
_sheet_id: logisheets_base::SheetId,
_row: usize,
_col: usize,
) -> Option<logisheets_base::CellId> {
todo!()
}

fn commit_calc_values(
&mut self,
vertex: FormulaId,
result: CalcValue,
_vertex: FormulaId,
_result: CalcValue,
) -> std::collections::HashSet<crate::vertex_manager::vertex::FormulaId> {
todo!()
}

fn is_async_func(&self, func_name: &str) -> bool {
fn is_async_func(&self, _func_name: &str) -> bool {
false
}
}
Expand Down
11 changes: 6 additions & 5 deletions crates/controller/src/calc_engine/calculator/funcs/vlookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ use super::CalcVertex;
use crate::calc_engine::connector::Connector;
use logisheets_parser::ast;

pub fn calc<C>(args: Vec<CalcVertex>, fetcher: &mut C) -> CalcVertex
#[allow(dead_code)]
pub fn calc<C>(args: Vec<CalcVertex>, _fetcher: &mut C) -> CalcVertex
where
C: Connector,
{
if args.len() != 3 && args.len() != 4 {
return CalcVertex::from_error(ast::Error::Unspecified);
}
let mut args_iter = args.into_iter();
let lookup_value = args_iter.next().unwrap();
let table_array = args_iter.next().unwrap();
let col_index_num = args_iter.next().unwrap();
let range_look_up = args_iter.next();
let _lookup_value = args_iter.next().unwrap();
let _table_array = args_iter.next().unwrap();
let _col_index_num = args_iter.next().unwrap();
let _range_look_up = args_iter.next();
todo!()
}
1 change: 0 additions & 1 deletion crates/controller/src/calc_engine/calculator/infix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ pub fn calc_infix(
}
ast::InfixOperator::Space => intersect(lhs, rhs),
ast::InfixOperator::Colon => get_range(lhs, rhs),
_ => unimplemented!(),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ fn get_range_of_range_and_row_range(range: Range, rr: RowRange) -> Option<Refere
Some(Reference::RowRange(RowRange { start, end }))
}

fn get_range_of_col_range_and_row_range(cr: ColRange, rr: RowRange) -> Option<Reference> {
fn get_range_of_col_range_and_row_range(_cr: ColRange, _rr: RowRange) -> Option<Reference> {
None
}

Expand Down
1 change: 0 additions & 1 deletion crates/controller/src/calc_engine/cycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ where
let mut finish = false;
let connector = self.connector;
let formulas = self.formulas;
let names = self.names;
let error = self.error;
let mut last_calc = vec![CalcValue::Scalar(Value::Blank); self.vertices.len()];
let mut dirties = HashSet::<FormulaId>::new();
Expand Down
2 changes: 1 addition & 1 deletion crates/controller/src/connectors/calc_connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl<'a> Connector for CalcConnector<'a> {
Some(from_sheet) => {
let sheets = self.get_sheet_ids(from_sheet, sheet_id);
sheets.into_iter().for_each(|s| {
let value = self.get_sheet_calc_range_value(
let _value = self.get_sheet_calc_range_value(
s, addr.row, addr.col, addr.row, addr.col,
);
});
Expand Down
6 changes: 5 additions & 1 deletion crates/controller/src/controller/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ fn handle_sheet_shift_payload(status: Status, payload: SheetShiftPayload) -> Sta
}
}

fn handle_name_proc(status: Status, payload: NamePayload, context: &TransactionContext) -> Status {
fn handle_name_proc(
_status: Status,
_payload: NamePayload,
_context: &TransactionContext,
) -> Status {
todo!()
}

Expand Down
14 changes: 7 additions & 7 deletions crates/controller/src/ext_book_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ impl ExtBooksManager {
book_id: ExtBookId,
from_sheet_id: Option<SheetId>,
sheet_id: SheetId,
start: Addr,
end: Addr,
_start: Addr,
_end: Addr,
) -> CalcValue {
self.check(book_id, sheet_id);
if let Some(f) = from_sheet_id {
Expand All @@ -60,7 +60,7 @@ impl ExtBooksManager {
&mut self,
book_id: ExtBookId,
sheet_id: SheetId,
addr: Addr,
_addr: Addr,
) -> CalcValue {
self.check(book_id, sheet_id);
CalcValue::Scalar(Value::Error(ast::Error::Ref))
Expand All @@ -71,8 +71,8 @@ impl ExtBooksManager {
book_id: ExtBookId,
from_sheet_id: Option<SheetId>,
sheet_id: SheetId,
start: usize,
end: usize,
_start: usize,
_end: usize,
) -> CalcValue {
self.check(book_id, sheet_id);
if let Some(f) = from_sheet_id {
Expand All @@ -86,8 +86,8 @@ impl ExtBooksManager {
book_id: ExtBookId,
from_sheet_id: Option<SheetId>,
sheet_id: SheetId,
start: usize,
end: usize,
_start: usize,
_end: usize,
) -> CalcValue {
self.check(book_id, sheet_id);
if let Some(f) = from_sheet_id {
Expand Down
1 change: 1 addition & 0 deletions crates/controller/src/file_loader2/styles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use logisheets_base::StyleId;
use logisheets_workbook::prelude::*;
use std::collections::HashMap;

#[allow(dead_code)]
pub struct StyleLoader<'a> {
manager: &'a mut StyleManager,
part: &'a StylesheetPart,
Expand Down
4 changes: 1 addition & 3 deletions crates/controller/src/file_loader2/vertex.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use logisheets_base::{id_fetcher::IdFetcherTrait, index_fetcher::IndexFetcherTrait, SheetId};
use logisheets_parser::{ast, context::Context, Parser};

use crate::vertex_manager::{
executors::input_formula::add_ast_node, status::Status as VertexStatus, VertexManager,
};
use crate::vertex_manager::{executors::input_formula::add_ast_node, VertexManager};

pub fn load_normal_formula<T>(
vertex_manager: &mut VertexManager,
Expand Down
2 changes: 0 additions & 2 deletions crates/controller/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ extern crate regex;
extern crate statrs;
extern crate unicode_segmentation;

mod addr_parser;
mod async_func_manager;
mod calc_engine;
mod cell;
Expand All @@ -22,7 +21,6 @@ mod navigator;
mod payloads;
mod settings;
mod style_manager;
mod utils;
mod vertex_manager;
mod workbook;

Expand Down
2 changes: 1 addition & 1 deletion crates/controller/src/navigator/fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ impl<'a> Fetcher<'a> {
(None, None) => Some((curr_row, curr_col)),
(None, Some(_)) => todo!(),
(Some(_), None) => todo!(),
(Some(rc), Some(cc)) => todo!(),
(Some(_rc), Some(_cc)) => todo!(),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/controller/src/style_manager/fill_manager.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::defaults::get_init_fill;
use super::manager::Manager;
use crate::payloads::sheet_process::style::{FillPayloadType, GradientPayload, PatternPayload};
use crate::payloads::sheet_process::style::FillPayloadType;
use logisheets_workbook::prelude::*;

pub type FillId = u32;
Expand Down
5 changes: 1 addition & 4 deletions crates/controller/src/style_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ use xf_manager::XfManager;

use crate::payloads::sheet_process::style::CellStylePayload;

use self::{
defaults::{get_init_border, get_init_fill, get_init_font},
execute::execute_style_payload,
};
use self::execute::execute_style_payload;
use crate::controller::display::Style;

#[derive(Debug, Clone, Default)]
Expand Down
Loading

0 comments on commit 082e5fd

Please sign in to comment.