diff --git a/lib/codegen/src/bforest/map.rs b/lib/codegen/src/bforest/map.rs index b6a62ef419..7cfa824a43 100644 --- a/lib/codegen/src/bforest/map.rs +++ b/lib/codegen/src/bforest/map.rs @@ -3,6 +3,10 @@ use super::{Comparator, Forest, Node, NodeData, NodePool, Path, INNER_SIZE}; use packed_option::PackedOption; use std::marker::PhantomData; +#[cfg(test)] +use std::fmt; +#[cfg(test)] +use std::string::String; /// Tag type defining forest types for a map. struct MapTypes(PhantomData<(K, V, C)>); @@ -207,14 +211,14 @@ where #[cfg(test)] impl Map where - K: Copy + ::std::fmt::Display, + K: Copy + fmt::Display, V: Copy, C: Comparator, { /// Verify consistency. fn verify(&self, forest: &MapForest, comp: &C) where - NodeData>: ::std::fmt::Display, + NodeData>: fmt::Display, { if let Some(root) = self.root.expand() { forest.nodes.verify_tree(root, comp); @@ -222,7 +226,7 @@ where } /// Get a text version of the path to `key`. - fn tpath(&self, key: K, forest: &MapForest, comp: &C) -> ::std::string::String { + fn tpath(&self, key: K, forest: &MapForest, comp: &C) -> String { use std::string::ToString; match self.root.expand() { None => "map(empty)".to_string(), @@ -406,8 +410,8 @@ where #[cfg(test)] impl<'a, K, V, C> MapCursor<'a, K, V, C> where - K: Copy + ::std::fmt::Display, - V: Copy + ::std::fmt::Display, + K: Copy + fmt::Display, + V: Copy + fmt::Display, C: Comparator, { fn verify(&self) { @@ -416,7 +420,7 @@ where } /// Get a text version of the path to the current position. - fn tpath(&self) -> ::std::string::String { + fn tpath(&self) -> String { use std::string::ToString; self.path.to_string() } diff --git a/lib/codegen/src/bforest/pool.rs b/lib/codegen/src/bforest/pool.rs index eed9402c84..d543991312 100644 --- a/lib/codegen/src/bforest/pool.rs +++ b/lib/codegen/src/bforest/pool.rs @@ -3,6 +3,8 @@ use super::{Forest, Node, NodeData}; use entity::PrimaryMap; use std::ops::{Index, IndexMut}; +#[cfg(test)] +use std::fmt; /// A pool of nodes, including a free list. pub(super) struct NodePool { @@ -74,8 +76,8 @@ impl NodePool { /// Verify the consistency of the tree rooted at `node`. pub fn verify_tree(&self, node: Node, comp: &F::Comparator) where - NodeData: ::std::fmt::Display, - F::Key: ::std::fmt::Display, + NodeData: fmt::Display, + F::Key: fmt::Display, { use super::Comparator; use entity::SparseSet; diff --git a/lib/codegen/src/bforest/set.rs b/lib/codegen/src/bforest/set.rs index 3c479dd876..667cd133e2 100644 --- a/lib/codegen/src/bforest/set.rs +++ b/lib/codegen/src/bforest/set.rs @@ -3,6 +3,10 @@ use super::{Comparator, Forest, Node, NodeData, NodePool, Path, SetValue, INNER_SIZE}; use packed_option::PackedOption; use std::marker::PhantomData; +#[cfg(test)] +use std::fmt; +#[cfg(test)] +use std::string::String; /// Tag type defining forest types for a set. struct SetTypes(PhantomData<(K, C)>); @@ -305,7 +309,7 @@ where #[cfg(test)] impl<'a, K, C> SetCursor<'a, K, C> where - K: Copy + ::std::fmt::Display, + K: Copy + fmt::Display, C: Comparator, { fn verify(&self) { @@ -314,7 +318,7 @@ where } /// Get a text version of the path to the current position. - fn tpath(&self) -> ::std::string::String { + fn tpath(&self) -> String { use std::string::ToString; self.path.to_string() } diff --git a/lib/codegen/src/dbg.rs b/lib/codegen/src/dbg.rs index 6c51bd23e5..a514dd7a05 100644 --- a/lib/codegen/src/dbg.rs +++ b/lib/codegen/src/dbg.rs @@ -116,7 +116,6 @@ macro_rules! dbg { if $crate::dbg::enabled() { // Drop the error result so we don't get compiler errors for ignoring it. // What are you going to do, log the error? - #[cfg(feature = "std")] $crate::dbg::writeln_with_format_args(format_args!($($arg)+)).ok(); } } diff --git a/lib/codegen/src/ir/extname.rs b/lib/codegen/src/ir/extname.rs index dcb3666703..ed723be6fe 100644 --- a/lib/codegen/src/ir/extname.rs +++ b/lib/codegen/src/ir/extname.rs @@ -121,6 +121,7 @@ mod tests { use super::ExternalName; use ir::LibCall; use std::string::ToString; + use std::u32; #[test] fn display_testcase() { @@ -143,7 +144,7 @@ mod tests { assert_eq!(ExternalName::user(0, 0).to_string(), "u0:0"); assert_eq!(ExternalName::user(1, 1).to_string(), "u1:1"); assert_eq!( - ExternalName::user(::std::u32::MAX, ::std::u32::MAX).to_string(), + ExternalName::user(u32::MAX, u32::MAX).to_string(), "u4294967295:4294967295" ); } diff --git a/lib/codegen/src/legalizer/libcall.rs b/lib/codegen/src/legalizer/libcall.rs index 8f69cba18d..17f9174706 100644 --- a/lib/codegen/src/legalizer/libcall.rs +++ b/lib/codegen/src/legalizer/libcall.rs @@ -2,6 +2,7 @@ use ir; use ir::InstBuilder; +use std::vec::Vec; /// Try to expand `inst` as a library call, returning true is successful. pub fn expand_as_libcall(inst: ir::Inst, func: &mut ir::Function) -> bool { @@ -15,7 +16,7 @@ pub fn expand_as_libcall(inst: ir::Inst, func: &mut ir::Function) -> bool { let funcref = find_funcref(libcall, func).unwrap_or_else(|| make_funcref(libcall, inst, func)); // Now we convert `inst` to a call. First save the arguments. - let mut args = vec![]; + let mut args = Vec::new(); args.extend_from_slice(func.dfg.inst_args(inst)); // The replace builder will preserve the instruction result values. func.dfg.replace(inst).call(funcref, &args);