summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJovansonlee Cesar <ivanceras@gmail.com>2018-08-03 00:46:11 +0800
committerJovansonlee Cesar <ivanceras@gmail.com>2018-08-03 00:46:11 +0800
commitc99d72ceeb3d185876c83aebbab25015854d2762 (patch)
tree4c1120e21d2e01a500e06ea53634d2e4ba0a5d22
parentdec13de59478424fef0f0f07ae389914c8d4bf10 (diff)
Remove warnings and error messages
-rw-r--r--svgbob/src/element.rs3
-rw-r--r--svgbob/src/enhance.rs46
-rw-r--r--svgbob/src/enhance_circle.rs66
-rw-r--r--svgbob/src/focus_char.rs13
-rw-r--r--svgbob/src/fragments.rs6
-rw-r--r--svgbob/src/grid.rs10
-rw-r--r--svgbob/src/lib.rs2
-rw-r--r--svgbob/src/optimizer.rs23
-rw-r--r--svgbob/src/properties.rs2
9 files changed, 66 insertions, 105 deletions
diff --git a/svgbob/src/element.rs b/svgbob/src/element.rs
index 55c2ee4..f7e0a41 100644
--- a/svgbob/src/element.rs
+++ b/svgbob/src/element.rs
@@ -90,9 +90,6 @@ pub fn big_circle_open_line(a: &Point, b: &Point) -> Element {
Element::Line(a.clone(), b.clone(), Solid, BigOpenCircle, Nothing)
}
-pub fn solid_circle(c: &Point, r: f32) -> Element {
- Element::Circle(c.clone(), r, "solid".to_string())
-}
pub fn arc(a: &Point, b: &Point, r: f32) -> Element {
Element::Arc(a.clone(), b.clone(), r, Minor, false, Solid, Nothing, Nothing)
diff --git a/svgbob/src/enhance.rs b/svgbob/src/enhance.rs
index 785e8f1..78dd504 100644
--- a/svgbob/src/enhance.rs
+++ b/svgbob/src/enhance.rs
@@ -2,9 +2,9 @@ use focus_char::FocusChar;
use fragments::Fragment;
use location::Location;
use location::Direction::{Bottom, BottomLeft, BottomRight, Left, Right, Top, TopLeft, TopRight};
-use block::Block::{A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y};
+use block::Block::{A, C, E, K, O, U, W, Y};
use point_block::PointBlock;
-use fragments::{self, line, arc, open_circle, arrow_line, dashed_line};
+use fragments::{line, arc, arrow_line, dashed_line};
pub trait Enhance {
fn enhance(&self) -> (Vec<Fragment>, Vec<Location>);
@@ -16,29 +16,29 @@ impl<'g> Enhance for FocusChar<'g> {
let mut elm = vec![];
let mut consumed = vec![];
let a = &PointBlock::block(A);
- let _b = &PointBlock::block(B);
+ //let _b = &PointBlock::block(B);
let c = &PointBlock::block(C);
- let _d = &PointBlock::block(D);
+ //let _d = &PointBlock::block(D);
let e = &PointBlock::block(E);
- let _f = &PointBlock::block(F);
- let _g = &PointBlock::block(G);
- let _h = &PointBlock::block(H);
- let _i = &PointBlock::block(I);
- let _j = &PointBlock::block(J);
+ //let _f = &PointBlock::block(F);
+ //let _g = &PointBlock::block(G);
+ //let _h = &PointBlock::block(H);
+ //let _i = &PointBlock::block(I);
+ //let _j = &PointBlock::block(J);
let k = &PointBlock::block(K);
- let l = &PointBlock::block(L);
- let m = &PointBlock::block(M);
- let n = &PointBlock::block(N);
+ //let _l = &PointBlock::block(L);
+ //let _m = &PointBlock::block(M);
+ //let _n = &PointBlock::block(N);
let o = &PointBlock::block(O);
- let _p = &PointBlock::block(P);
- let _q = &PointBlock::block(Q);
- let _r = &PointBlock::block(R);
- let _s = &PointBlock::block(S);
- let _t = &PointBlock::block(T);
+ //let _p = &PointBlock::block(P);
+ //let _q = &PointBlock::block(Q);
+ //let _r = &PointBlock::block(R);
+ //let _s = &PointBlock::block(S);
+ //let _t = &PointBlock::block(T);
let u = &PointBlock::block(U);
- let _v = &PointBlock::block(V);
+ //let _v = &PointBlock::block(V);
let w = &PointBlock::block(W);
- let _x = &PointBlock::block(X);
+ //let _x = &PointBlock::block(X);
let y = &PointBlock::block(Y);
let this = || Location::this();
@@ -51,14 +51,6 @@ impl<'g> Enhance for FocusChar<'g> {
let bottom_left = || Location::go(BottomLeft);
let bottom_right = || Location::go(BottomRight);
- let top2 = || Location::jump(Top,2);
- let bottom2 = || Location::jump(Bottom,2);
- let left2 = || Location::jump(Left,2);
- let right2 = || Location::jump(Right,2);
- let top_right2 = || top().go_right(2);
- let top_left2 = || top().go_left(2);
- let bottom_right2 = || bottom().go_right(2);
- let bottom_left2 = || bottom().go_left(2);
// _ underscore
if self.is('_') {
diff --git a/svgbob/src/enhance_circle.rs b/svgbob/src/enhance_circle.rs
index 3e4bfe2..b1f8d40 100644
--- a/svgbob/src/enhance_circle.rs
+++ b/svgbob/src/enhance_circle.rs
@@ -3,10 +3,9 @@ use focus_char::FocusChar;
use fragments::Fragment;
use location::Location;
use location::Direction::{Bottom, BottomLeft, BottomRight, Left, Right, Top, TopLeft, TopRight};
-use block::Block::{A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y};
+use block::Block::{K, M, O};
use point_block::PointBlock;
-use fragments::{self, line, arc, open_circle, arrow_line, dashed_line};
-use properties::Can::{ConnectTo,Is,IsStrongAll};
+use fragments::open_circle;
pub trait EnhanceCircle {
fn enhance_circle(&self) -> (Vec<Fragment>, Vec<Location>);
@@ -17,31 +16,32 @@ impl<'g> EnhanceCircle for FocusChar<'g> {
fn enhance_circle(&self) -> (Vec<Fragment>, Vec<Location>) {
let mut elm = vec![];
let mut consumed = vec![];
- let a = &PointBlock::block(A);
- let _b = &PointBlock::block(B);
- let c = &PointBlock::block(C);
- let _d = &PointBlock::block(D);
- let e = &PointBlock::block(E);
- let _f = &PointBlock::block(F);
- let _g = &PointBlock::block(G);
- let _h = &PointBlock::block(H);
- let _i = &PointBlock::block(I);
- let _j = &PointBlock::block(J);
- let k = &PointBlock::block(K);
- let l = &PointBlock::block(L);
+
+ //let _a = &PointBlock::block(A);
+ //let _b = &PointBlock::block(B);
+ //let c = &PointBlock::block(C);
+ //let _d = &PointBlock::block(D);
+ //let e = &PointBlock::block(E);
+ //let _f = &PointBlock::block(F);
+ //let _g = &PointBlock::block(G);
+ //let _h = &PointBlock::block(H);
+ //let _i = &PointBlock::block(I);
+ //let _j = &PointBlock::block(J);
+ //let k = &PointBlock::block(K);
+ //let _l = &PointBlock::block(L);
let m = &PointBlock::block(M);
- let n = &PointBlock::block(N);
+ //let _n = &PointBlock::block(N);
let o = &PointBlock::block(O);
- let _p = &PointBlock::block(P);
- let _q = &PointBlock::block(Q);
- let _r = &PointBlock::block(R);
- let _s = &PointBlock::block(S);
- let _t = &PointBlock::block(T);
- let u = &PointBlock::block(U);
- let _v = &PointBlock::block(V);
- let w = &PointBlock::block(W);
- let _x = &PointBlock::block(X);
- let y = &PointBlock::block(Y);
+ //let _p = &PointBlock::block(P);
+ //let _q = &PointBlock::block(Q);
+ //let _r = &PointBlock::block(R);
+ //let _s = &PointBlock::block(S);
+ //let _t = &PointBlock::block(T);
+ //let u = &PointBlock::block(U);
+ //let _v = &PointBlock::block(V);
+ //let w = &PointBlock::block(W);
+ //let _x = &PointBlock::block(X);
+ //let y = &PointBlock::block(Y);
let this = || Location::this();
let top = || Location::go(Top);
@@ -54,7 +54,7 @@ impl<'g> EnhanceCircle for FocusChar<'g> {
let bottom_right = || Location::go(BottomRight);
let top2 = || Location::jump(Top,2);
- let bottom2 = || Location::jump(Bottom,2);
+ //let bottom2 = || Location::jump(Bottom,2);
let left2 = || Location::jump(Left,2);
let right2 = || Location::jump(Right,2);
let top_right2 = || top().go_right(2);
@@ -62,14 +62,14 @@ impl<'g> EnhanceCircle for FocusChar<'g> {
let bottom_right2 = || bottom().go_right(2);
let bottom_left2 = || bottom().go_left(2);
- let top3 = || Location::jump(Top,3);
- let bottom3 = || Location::jump(Bottom,3);
+ //let top3 = || Location::jump(Top,3);
+ //let bottom3 = || Location::jump(Bottom,3);
let left3 = || Location::jump(Left,3);
let right3 = || Location::jump(Right,3);
- let top_right3 = || top().go_right(3);
- let top_left3 = || top().go_left(3);
- let bottom_right3 = || bottom().go_right(3);
- let bottom_left3 = || bottom().go_left(3);
+ //let top_right3 = || top().go_right(3);
+ //let top_left3 = || top().go_left(3);
+ //let bottom_right3 = || bottom().go_right(3);
+ //let bottom_left3 = || bottom().go_left(3);
// circle 4
// _
diff --git a/svgbob/src/focus_char.rs b/svgbob/src/focus_char.rs
index cb9fde6..207bbb1 100644
--- a/svgbob/src/focus_char.rs
+++ b/svgbob/src/focus_char.rs
@@ -13,7 +13,7 @@ use point::Point;
use loc_block::LocBlock;
use element::Element;
use fragments::Fragment::Text;
-use element::{line,dashed_line,circle_start_line, square_start_line, circle_open_line,big_circle_open_line, arrow_line,start_arrow_line,arc,open_circle,solid_circle,text};
+use element::{line,dashed_line,circle_start_line, square_start_line, circle_open_line,big_circle_open_line, arrow_line,start_arrow_line,arc,open_circle,text};
use location::Location;
use settings::Settings;
use enhance::Enhance;
@@ -179,14 +179,9 @@ impl<'g> FocusChar<'g> {
Fragment::BigCircleOpenLine(p1, p2) => big_circle_open_line(&self.point(&p1), &self.point(&p2)),
Fragment::DashedLine(p1, p2) => dashed_line(&self.point(&p1), &self.point(&p2)),
Fragment::ArrowLine(p1, p2) => arrow_line(&self.point(&p1), &self.point(&p2)),
-
Fragment::StartArrowLine(p1, p2) => start_arrow_line(&self.point(&p1), &self.point(&p2)),
-
Fragment::Arc(p1, p2, m) => arc(&self.point(&p1), &self.point(&p2), m as f32 * unit_x),
-
Fragment::OpenCircle(c, m) => open_circle(&self.point(&c), m as f32 * unit_x),
-
- Fragment::SolidCircle(c, m) => solid_circle(&self.point(&c), m as f32 * unit_x),
Fragment::Text(s) => text(&self.loc, &s),
}
}
@@ -210,7 +205,7 @@ impl<'g> FocusChar<'g> {
/// return the ehance circle elements and the consumed locations
pub fn get_enhance_circle_elements(&self) -> (Vec<Element>, Vec<Loc>) {
let (fragments, consumed_location) = self.get_enhance_circle_fragments();
- let mut elements: Vec<Element> = fragments
+ let elements: Vec<Element> = fragments
.into_iter()
.map(|frag| self.to_element(frag))
.collect();
@@ -224,7 +219,7 @@ impl<'g> FocusChar<'g> {
/// return the ehance elements and the consumed locations
pub fn get_enhance_elements(&self) -> (Vec<Element>, Vec<Loc>) {
let (fragments, consumed_location) = self.get_enhance_fragments();
- let mut elements: Vec<Element> = fragments
+ let elements: Vec<Element> = fragments
.into_iter()
.map(|frag| self.to_element(frag))
.collect();
@@ -238,7 +233,7 @@ impl<'g> FocusChar<'g> {
/// returns the defaults elements
pub fn get_elements(&self) -> Vec<Element> {
let fragments = self.get_fragments();
- let mut elements: Vec<Element> = fragments
+ let elements: Vec<Element> = fragments
.into_iter()
.map(|frag| self.to_element(frag))
.collect();
diff --git a/svgbob/src/fragments.rs b/svgbob/src/fragments.rs
index 87c60b1..20b8ce7 100644
--- a/svgbob/src/fragments.rs
+++ b/svgbob/src/fragments.rs
@@ -1,4 +1,4 @@
-use self::Fragment::{Arc, ArrowLine, Line, DashedLine, CircleStartLine, SquareStartLine, CircleOpenLine, BigCircleOpenLine, OpenCircle, SolidCircle, StartArrowLine};
+use self::Fragment::{Arc, ArrowLine, Line, DashedLine, CircleStartLine, SquareStartLine, CircleOpenLine, BigCircleOpenLine, OpenCircle, StartArrowLine};
use point_block::PointBlock;
@@ -19,7 +19,6 @@ pub enum Fragment {
StartArrowLine(PointBlock, PointBlock), // the arrow is at the start marker
Arc(PointBlock, PointBlock, i32), //i32 is the multiplier to 1/4 of textwidth
OpenCircle(PointBlock, i32),
- SolidCircle(PointBlock, i32),
Text(String),
}
@@ -53,7 +52,4 @@ pub fn arc(s: &PointBlock, e: &PointBlock, r: i32) -> Fragment {
pub fn open_circle(c: &PointBlock, r: i32) -> Fragment {
OpenCircle(c.clone(), r)
}
-pub fn solid_circle(c: &PointBlock, r: i32) -> Fragment {
- SolidCircle(c.clone(), r)
-}
diff --git a/svgbob/src/grid.rs b/svgbob/src/grid.rs
index d3a9662..86e0e8c 100644
--- a/svgbob/src/grid.rs
+++ b/svgbob/src/grid.rs
@@ -290,7 +290,7 @@ impl Grid {
let mut new_index: Vec<Vec<String>> = vec![];
for (y,line) in self.index.iter().enumerate(){
let mut row: Vec<String> = vec![];
- for (x,cell) in line.iter().enumerate(){
+ for (x,_) in line.iter().enumerate(){
let loc = &Loc::new(x as i32, y as i32);
let swap = self.swap_char(loc);
row.push(swap.to_string());
@@ -428,7 +428,7 @@ fn circle_marker() -> Marker {
.set("markerWidth", 5)
.set("markerHeight", 5);
- let mut circle = SvgCircle::new()
+ let circle = SvgCircle::new()
.set("cx",10)
.set("cy",10)
.set("r",8)
@@ -446,7 +446,7 @@ fn square_marker() -> Marker {
.set("markerWidth", 5)
.set("markerHeight", 5);
- let mut square = SvgRect::new()
+ let square = SvgRect::new()
.set("x",0)
.set("y",0)
.set("width",20)
@@ -465,7 +465,7 @@ fn open_circle_marker() -> Marker {
.set("markerWidth", 10)
.set("markerHeight", 10);
- let mut circle = SvgCircle::new()
+ let circle = SvgCircle::new()
.set("cx",10)
.set("cy",10)
.set("r",4)
@@ -484,7 +484,7 @@ fn big_open_circle_marker() -> Marker {
.set("markerWidth", 20)
.set("markerHeight", 20);
- let mut circle = SvgCircle::new()
+ let circle = SvgCircle::new()
.set("cx",20)
.set("cy",20)
.set("r",6)
diff --git a/svgbob/src/lib.rs b/svgbob/src/lib.rs
index 5b0e6f4..e08e2b8 100644
--- a/svgbob/src/lib.rs
+++ b/svgbob/src/lib.rs
@@ -29,7 +29,7 @@
//! </svg>
//!
//!
-//#![deny(warnings)]
+#![deny(warnings)]
#![feature(extern_prelude)]
extern crate pom;
#[cfg(test)]
diff --git a/svgbob/src/optimizer.rs b/svgbob/src/optimizer.rs
index 0f7609e..01a99d0 100644
--- a/svgbob/src/optimizer.rs
+++ b/svgbob/src/optimizer.rs
@@ -1,5 +1,5 @@
use element::Element;
-use element::Feature::{self, OpenCircle, BigOpenCircle};
+use element::Feature::{OpenCircle, BigOpenCircle};
use loc::Loc;
use settings::Settings;
use element::Stroke;
@@ -129,25 +129,6 @@ impl Optimizer {
}
}
- fn get_excess_elements(&self, complete_consumed: &Vec<Loc>, decimated: &Vec<(Loc,usize)>) -> Vec<Element> {
- let mut excess = vec![];
- for (y, line) in self.elements.iter().enumerate(){
- for (x, cell) in line.iter().enumerate(){
- let loc = &Loc::new(x as i32, y as i32);
- if !complete_consumed.contains(loc){
- for (elm_index, elm) in cell.iter().enumerate(){
- if !decimated.contains(&(loc.clone(), elm_index)){
- // this one is consumed
- }
- else{
- excess.push(elm.clone());
- }
- }
- }
- }
- }
- excess
- }
// take all paths and non-arrow line in 1 path
// the text in separated
fn merge_paths(&self, elements: Vec<Element>) -> Vec<Element> {
@@ -200,7 +181,7 @@ impl Optimizer {
merged.extend(dashed_arcs);
merged.extend(text);
merged.extend(circles);
- /// put last to be infront of everything
+ // put last to be infront of everything
merged.extend(featured_circle_solid_lines);
merged
}
diff --git a/svgbob/src/properties.rs b/svgbob/src/properties.rs
index 05333b4..b417169 100644
--- a/svgbob/src/properties.rs
+++ b/svgbob/src/properties.rs
@@ -5,7 +5,7 @@ use block::Block::{A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U
use point_block::PointBlock;
use fragments::Fragment;
-use fragments::{arc, arrow_line, line, circle_start_line, square_start_line, circle_open_line, big_circle_open_line, open_circle, solid_circle, start_arrow_line, dashed_line};
+use fragments::{arc, arrow_line, line, circle_start_line, square_start_line, circle_open_line, big_circle_open_line, start_arrow_line, dashed_line};
use self::Signal::{Medium, Strong, Weak};
use box_drawing;