Navigation Menu

Skip to content

Commit

Permalink
Fix warnings and use debug builders
Browse files Browse the repository at this point in the history
  • Loading branch information
sfackler committed Mar 14, 2015
1 parent efcdc74 commit 4d28684
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 43 deletions.
2 changes: 1 addition & 1 deletion phf/src/lib.rs
Expand Up @@ -4,7 +4,7 @@
//! `phf_macros` crate or via code generation in the `phf_codegen` crate. See
//! the documentation of those crates for more details.
#![doc(html_root_url="https://sfackler.github.io/rust-phf/doc")]
#![feature(core, no_std)]
#![feature(core, debug_builders)]
#![warn(missing_docs)]

extern crate phf_shared;
Expand Down
13 changes: 4 additions & 9 deletions phf/src/map.rs
Expand Up @@ -26,16 +26,11 @@ pub struct Map<K:'static, V:'static> {

impl<K, V> fmt::Debug for Map<K, V> where K: fmt::Debug, V: fmt::Debug {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
try!(write!(fmt, "Map {{"));
let mut first = true;
for (k, v) in self.entries() {
if !first {
try!(write!(fmt, ", "));
}
try!(write!(fmt, "{:?}: {:?}", k, v));
first = false;
let mut builder = fmt.debug_map("Map");
for (k, v) in self {
builder = builder.entry(k, v);
}
write!(fmt, "}}")
builder.finish()
}
}

Expand Down
13 changes: 4 additions & 9 deletions phf/src/ordered_map.rs
Expand Up @@ -32,16 +32,11 @@ pub struct OrderedMap<K:'static, V:'static> {

impl<K, V> fmt::Debug for OrderedMap<K, V> where K: fmt::Debug, V: fmt::Debug {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
try!(write!(fmt, "OrderedMap {{"));
let mut first = true;
for (k, v) in self.entries() {
if !first {
try!(write!(fmt, ", "));
}
try!(write!(fmt, "{:?}: {:?}", k, v));
first = false;
let mut builder = fmt.debug_map("OrderedMap");
for (k, v) in self {
builder = builder.entry(k, v);
}
write!(fmt, "}}")
builder.finish()
}
}

Expand Down
13 changes: 4 additions & 9 deletions phf/src/ordered_set.rs
Expand Up @@ -23,16 +23,11 @@ pub struct OrderedSet<T:'static> {

impl<T> fmt::Debug for OrderedSet<T> where T: fmt::Debug {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
try!(write!(fmt, "OrderedSet {{"));
let mut first = true;
for entry in self.iter() {
if !first {
try!(write!(fmt, ", "));
}
try!(write!(fmt, "{:?}", entry));
first = false;
let mut builder = fmt.debug_set("OrderedSet");
for entry in self {
builder = builder.entry(entry);
}
write!(fmt, "}}")
builder.finish()
}
}

Expand Down
13 changes: 4 additions & 9 deletions phf/src/set.rs
Expand Up @@ -22,16 +22,11 @@ pub struct Set<T:'static> {

impl<T> fmt::Debug for Set<T> where T: fmt::Debug {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
try!(write!(fmt, "Set {{"));
let mut first = true;
for entry in self.iter() {
if !first {
try!(write!(fmt, ", "));
}
try!(write!(fmt, "{:?}", entry));
first = false;
let mut builder = fmt.debug_set("Set");
for entry in self {
builder = builder.entry(entry);
}
write!(fmt, "}}")
builder.finish()
}
}

Expand Down
2 changes: 0 additions & 2 deletions phf_codegen/src/lib.rs
Expand Up @@ -55,8 +55,6 @@
//! }
//! ```
#![doc(html_root_url="http://sfackler.github.io/rust-phf/doc")]
#![feature(io)]

extern crate phf_shared;
extern crate phf_generator;

Expand Down
2 changes: 0 additions & 2 deletions phf_codegen/test/build.rs
@@ -1,5 +1,3 @@
#![feature(io, path)]

extern crate phf_codegen;

use std::fs::File;
Expand Down
4 changes: 2 additions & 2 deletions phf_macros/tests/test.rs
Expand Up @@ -123,7 +123,7 @@ mod map {
}

#[test]
#[should_fail]
#[should_panic]
fn test_index_fail() {
static MAP: phf::Map<&'static str, isize> = phf_map!(
"a" => 0,
Expand Down Expand Up @@ -378,7 +378,7 @@ mod ordered_map {
}

#[test]
#[should_fail]
#[should_panic]
fn test_index_fail() {
static MAP: phf::OrderedMap<&'static str, isize> = phf_ordered_map!(
"a" => 0,
Expand Down

0 comments on commit 4d28684

Please sign in to comment.