Remove warnings

This commit is contained in:
Dima Kudosh
2016-03-01 15:00:07 +03:00
parent ef70f2450e
commit 16fc483ea1
3 changed files with 7 additions and 8 deletions
+4 -5
View File
@@ -53,8 +53,8 @@ impl Differ{
if !(first_start < first_end && second_start < second_end){
return Vec::new();
}
let mut first = Vec::new();
let mut second = Vec::new();
let mut first;
let second;
if second_end - second_start < first_end - first_start{
first = self.dump("+", second_sequence, second_start, second_end);
second = self.dump("-", first_sequence, first_start, first_end);
@@ -73,7 +73,7 @@ impl Differ{
let mut res = Vec::new();
let (mut best_ratio, cutoff) = (0.74, 0.75);
let (mut best_i, mut best_j) = (0, 0);
let (mut second_sequence_str, mut first_sequence_str) = ("", "");
let (mut second_sequence_str, mut first_sequence_str);
let mut eqi: Option<usize> = None;
let mut eqj: Option<usize> = None;
for j in second_start..second_end{
@@ -103,7 +103,6 @@ impl Differ{
}
best_i = eqi.unwrap();
best_j = eqj.unwrap();
best_ratio = 1.0;
} else {
eqi = None;
}
@@ -187,7 +186,7 @@ impl Differ{
panic!("Second parameter must be 1 or 2");
}
let mut res = Vec::new();
let mut tag = String::new();
let tag;
if which == 1 {
tag = "- ".to_string();
} else {
+1 -1
View File
@@ -107,7 +107,7 @@ pub fn context_diff<T: Sequence>(first_sequence: &T, second_sequence: &T, from_f
}
}
let file2_range = format_range_context(first.second_start, last.second_end);
res.push(format!("--- {} ----{}", file1_range, lineterm));
res.push(format!("--- {} ----{}", file2_range, lineterm));
any = false;
for opcode in group {
if opcode.tag == "replace" || opcode.tag == "insert" {
+2 -2
View File
@@ -1,5 +1,5 @@
use std::collections::HashMap;
use std::cmp::{Ordering, max, min};
use std::cmp::{max, min};
use utils::calculate_ratio;
use std::fmt::Debug;
@@ -67,7 +67,7 @@ impl<'a> Sequence for Vec<&'a str> {
}
fn at_index(&self, index: usize) -> Option<&str> {
if index < self.len() && index >= 0 {
if index < self.len() {
return Some(self[index])
}
None