Skip to content

Commit

Permalink
Removed unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
octavonce committed Nov 9, 2021
1 parent ae3e292 commit 28ce649
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 21 deletions.
5 changes: 0 additions & 5 deletions src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ use core::fmt::Debug;
#[cfg(not(feature = "no_std"))]
use std::fmt::Debug;

#[cfg(feature = "no_std")]
use core::mem;

#[cfg(feature = "no_std")]
extern crate alloc;
#[cfg(feature = "no_std")]
Expand Down Expand Up @@ -89,8 +86,6 @@ pub struct Graph<T> {
edge_labels: HashMap<Edge, String>,
}

const DEFAULT_LABEL: &str = "";

impl<T> Graph<T> {
/// Creates a new graph.
///
Expand Down
10 changes: 2 additions & 8 deletions src/iterators/bfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ impl<'a, T> Iterator for Bfs<'a, T> {

fn next(&mut self) -> Option<Self::Item> {
loop {
let mut next_ptr = None;

if let Some(current_ptr) = &self.current_ptr {
// Yield current pointed value if
// it isn't in the visited stack.
Expand All @@ -80,23 +78,19 @@ impl<'a, T> Iterator for Bfs<'a, T> {
// Move to next root if possible and yield it.
if self.queue.is_empty() {
if let Some(next_root) = self.roots_stack.pop() {
next_ptr = Some(next_root);
self.current_ptr = Some(next_root);
} else {
// Break execution if there are no more roots
return None;
}
} else {
// Pop item from queue and set it
// as the current pointer.
next_ptr = self.queue.pop_front();
self.current_ptr = self.queue.pop_front();
}
} else {
return None;
}

if next_ptr.is_some() {
self.current_ptr = next_ptr;
}
}
}
}
6 changes: 0 additions & 6 deletions src/iterators/owning_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

use crate::vertex_id::VertexId;

#[cfg(feature = "no_std")]
extern crate alloc;

#[cfg(feature = "no_std")]
use alloc::boxed::Box;

#[cfg(not(feature = "no_std"))]
use std::fmt::Debug;

Expand Down
2 changes: 1 addition & 1 deletion src/iterators/topo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl<'a, T> Topo<'a, T> {
}
None => {
if check_cyclic && self.vertices.len() != self.iterable.vertex_count() {
panic!(PANIC_MSG);
panic!("{}", PANIC_MSG);
}
None
}
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright 2019 Octavian Oncescu

#![cfg_attr(feature = "no_std", feature(alloc))]
#![cfg_attr(feature = "no_std", no_std)]

//! # Graphlib
Expand Down

0 comments on commit 28ce649

Please sign in to comment.