Fix all clippy warnings or block them.
This commit is contained in:
@@ -43,7 +43,7 @@ fn vec_split_into<T>(v: Vec<T>, offset: usize) -> (Vec<T>, Vec<T>) {
|
||||
|
||||
impl KDTree {
|
||||
pub fn new(l: Vec<Box<Hit>>, t_min: f32, t_max: f32) -> KDTree {
|
||||
if l.len() == 0 {
|
||||
if l.is_empty() {
|
||||
panic!("Attempt to build k-d tree with no Hit objects");
|
||||
}
|
||||
|
||||
@@ -119,15 +119,15 @@ fn print_tree(f: &mut fmt::Formatter, depth: usize, kdt: &KDTree) -> fmt::Result
|
||||
let vol = kdt.volume();
|
||||
write!(f, "{:8.2}{}", vol, " ".repeat(depth * 2))?;
|
||||
match kdt {
|
||||
KDTree::Leaf(ref hit) => write!(
|
||||
KDTree::Leaf(ref hit) => writeln!(
|
||||
f,
|
||||
"Leaf: {}\n",
|
||||
"Leaf: {}",
|
||||
hit.bounding_box(0., 0.)
|
||||
.map_or("NO BBOX".to_owned(), |bb| bb.to_string())
|
||||
)?,
|
||||
KDTree::Branch { bbox, .. } => write!(
|
||||
KDTree::Branch { bbox, .. } => writeln!(
|
||||
f,
|
||||
"Branch: {}\n",
|
||||
"Branch: {}",
|
||||
// TODO(wathiede): removing this .clone() results in a complaint about moving out
|
||||
// of a borrow.
|
||||
bbox.clone()
|
||||
@@ -143,7 +143,7 @@ fn print_tree(f: &mut fmt::Formatter, depth: usize, kdt: &KDTree) -> fmt::Result
|
||||
|
||||
impl fmt::Display for KDTree {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "kd-tree\n")?;
|
||||
writeln!(f, "kd-tree")?;
|
||||
print_tree(f, 1, &self)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user