bump dev dependency / fmt

This commit is contained in:
Chris West (Faux) 2018-12-17 19:04:09 +00:00
parent 46ad5e2bb2
commit 7f180bc3ef
6 changed files with 21 additions and 18 deletions

View File

@ -23,7 +23,7 @@ libc = "0.2"
[dev-dependencies] [dev-dependencies]
boolinator = "2" boolinator = "2"
itertools = "0.7" itertools = "0.8"
[features] [features]
default = [] default = []

View File

@ -3,8 +3,8 @@ extern crate itertools;
use itertools::Itertools; use itertools::Itertools;
use apt_pkg_native::Cache;
use apt_pkg_native::simple; use apt_pkg_native::simple;
use apt_pkg_native::Cache;
fn main() { fn main() {
let mut cache = Cache::get_singleton(); let mut cache = Cache::get_singleton();

View File

@ -1,8 +1,8 @@
extern crate apt_pkg_native; extern crate apt_pkg_native;
use std::env; use std::env;
use apt_pkg_native::Cache;
use apt_pkg_native::simple; use apt_pkg_native::simple;
use apt_pkg_native::Cache;
fn main() { fn main() {
let pkg = env::args() let pkg = env::args()
@ -19,7 +19,8 @@ fn main() {
if let Some(view) = found.next() { if let Some(view) = found.next() {
println!("{}:{}:", view.name(), view.arch()); println!("{}:{}:", view.name(), view.arch());
let installed_version = view.current_version() let installed_version = view
.current_version()
.unwrap_or_else(|| "(none)".to_string()); .unwrap_or_else(|| "(none)".to_string());
println!(" Installed: {}", installed_version); println!(" Installed: {}", installed_version);
println!( println!(

View File

@ -171,9 +171,11 @@ where
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
loop { loop {
match self.it.next() { match self.it.next() {
Some(ref x) => if let Some(y) = (self.f)(x) { Some(ref x) => {
return Some(y); if let Some(y) = (self.f)(x) {
}, return Some(y);
}
}
None => return None, None => return None,
} }
} }

View File

@ -64,14 +64,10 @@ mod tests {
panic!("not found!"); panic!("not found!");
} }
assert!( assert!(cache
cache .find_by_name("this-package-doesnt-exist-and-if-someone-makes-it-ill-be-really-angry")
.find_by_name( .next()
"this-package-doesnt-exist-and-if-someone-makes-it-ill-be-really-angry" .is_none());
)
.next()
.is_none()
);
} }
#[test] #[test]

View File

@ -122,8 +122,11 @@ impl Origin {
impl fmt::Display for Origin { impl fmt::Display for Origin {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// trying to simulate apt-cache policy, but a lot of information is missing // trying to simulate apt-cache policy, but a lot of information is missing
if self.site.is_some() && self.origin.is_some() && self.label.is_some() if self.site.is_some()
&& self.codename.is_some() && self.architecture.is_some() && self.origin.is_some()
&& self.label.is_some()
&& self.codename.is_some()
&& self.architecture.is_some()
{ {
write!( write!(
f, f,
@ -153,7 +156,8 @@ impl VersionOrigins {
pub fn new(view: &sane::VerView) -> Self { pub fn new(view: &sane::VerView) -> Self {
VersionOrigins { VersionOrigins {
version: Version::new(view), version: Version::new(view),
origins: view.origin_iter() origins: view
.origin_iter()
.map(|o| { .map(|o| {
Origin::from_ver_file(o) Origin::from_ver_file(o)
.expect("a version's origin should always have a backing file") .expect("a version's origin should always have a backing file")