Use use declarations rather than '::std::...' names.
This is what most of the rest of the codebase does, so this patch just tidies up a few additional places.
This commit is contained in:
@@ -3,6 +3,10 @@
|
|||||||
use super::{Comparator, Forest, Node, NodeData, NodePool, Path, INNER_SIZE};
|
use super::{Comparator, Forest, Node, NodeData, NodePool, Path, INNER_SIZE};
|
||||||
use packed_option::PackedOption;
|
use packed_option::PackedOption;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
#[cfg(test)]
|
||||||
|
use std::fmt;
|
||||||
|
#[cfg(test)]
|
||||||
|
use std::string::String;
|
||||||
|
|
||||||
/// Tag type defining forest types for a map.
|
/// Tag type defining forest types for a map.
|
||||||
struct MapTypes<K, V, C>(PhantomData<(K, V, C)>);
|
struct MapTypes<K, V, C>(PhantomData<(K, V, C)>);
|
||||||
@@ -207,14 +211,14 @@ where
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
impl<K, V, C> Map<K, V, C>
|
impl<K, V, C> Map<K, V, C>
|
||||||
where
|
where
|
||||||
K: Copy + ::std::fmt::Display,
|
K: Copy + fmt::Display,
|
||||||
V: Copy,
|
V: Copy,
|
||||||
C: Comparator<K>,
|
C: Comparator<K>,
|
||||||
{
|
{
|
||||||
/// Verify consistency.
|
/// Verify consistency.
|
||||||
fn verify(&self, forest: &MapForest<K, V, C>, comp: &C)
|
fn verify(&self, forest: &MapForest<K, V, C>, comp: &C)
|
||||||
where
|
where
|
||||||
NodeData<MapTypes<K, V, C>>: ::std::fmt::Display,
|
NodeData<MapTypes<K, V, C>>: fmt::Display,
|
||||||
{
|
{
|
||||||
if let Some(root) = self.root.expand() {
|
if let Some(root) = self.root.expand() {
|
||||||
forest.nodes.verify_tree(root, comp);
|
forest.nodes.verify_tree(root, comp);
|
||||||
@@ -222,7 +226,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get a text version of the path to `key`.
|
/// Get a text version of the path to `key`.
|
||||||
fn tpath(&self, key: K, forest: &MapForest<K, V, C>, comp: &C) -> ::std::string::String {
|
fn tpath(&self, key: K, forest: &MapForest<K, V, C>, comp: &C) -> String {
|
||||||
use std::string::ToString;
|
use std::string::ToString;
|
||||||
match self.root.expand() {
|
match self.root.expand() {
|
||||||
None => "map(empty)".to_string(),
|
None => "map(empty)".to_string(),
|
||||||
@@ -406,8 +410,8 @@ where
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
impl<'a, K, V, C> MapCursor<'a, K, V, C>
|
impl<'a, K, V, C> MapCursor<'a, K, V, C>
|
||||||
where
|
where
|
||||||
K: Copy + ::std::fmt::Display,
|
K: Copy + fmt::Display,
|
||||||
V: Copy + ::std::fmt::Display,
|
V: Copy + fmt::Display,
|
||||||
C: Comparator<K>,
|
C: Comparator<K>,
|
||||||
{
|
{
|
||||||
fn verify(&self) {
|
fn verify(&self) {
|
||||||
@@ -416,7 +420,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get a text version of the path to the current position.
|
/// 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;
|
use std::string::ToString;
|
||||||
self.path.to_string()
|
self.path.to_string()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
use super::{Forest, Node, NodeData};
|
use super::{Forest, Node, NodeData};
|
||||||
use entity::PrimaryMap;
|
use entity::PrimaryMap;
|
||||||
use std::ops::{Index, IndexMut};
|
use std::ops::{Index, IndexMut};
|
||||||
|
#[cfg(test)]
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
/// A pool of nodes, including a free list.
|
/// A pool of nodes, including a free list.
|
||||||
pub(super) struct NodePool<F: Forest> {
|
pub(super) struct NodePool<F: Forest> {
|
||||||
@@ -74,8 +76,8 @@ impl<F: Forest> NodePool<F> {
|
|||||||
/// Verify the consistency of the tree rooted at `node`.
|
/// Verify the consistency of the tree rooted at `node`.
|
||||||
pub fn verify_tree(&self, node: Node, comp: &F::Comparator)
|
pub fn verify_tree(&self, node: Node, comp: &F::Comparator)
|
||||||
where
|
where
|
||||||
NodeData<F>: ::std::fmt::Display,
|
NodeData<F>: fmt::Display,
|
||||||
F::Key: ::std::fmt::Display,
|
F::Key: fmt::Display,
|
||||||
{
|
{
|
||||||
use super::Comparator;
|
use super::Comparator;
|
||||||
use entity::SparseSet;
|
use entity::SparseSet;
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
use super::{Comparator, Forest, Node, NodeData, NodePool, Path, SetValue, INNER_SIZE};
|
use super::{Comparator, Forest, Node, NodeData, NodePool, Path, SetValue, INNER_SIZE};
|
||||||
use packed_option::PackedOption;
|
use packed_option::PackedOption;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
#[cfg(test)]
|
||||||
|
use std::fmt;
|
||||||
|
#[cfg(test)]
|
||||||
|
use std::string::String;
|
||||||
|
|
||||||
/// Tag type defining forest types for a set.
|
/// Tag type defining forest types for a set.
|
||||||
struct SetTypes<K, C>(PhantomData<(K, C)>);
|
struct SetTypes<K, C>(PhantomData<(K, C)>);
|
||||||
@@ -305,7 +309,7 @@ where
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
impl<'a, K, C> SetCursor<'a, K, C>
|
impl<'a, K, C> SetCursor<'a, K, C>
|
||||||
where
|
where
|
||||||
K: Copy + ::std::fmt::Display,
|
K: Copy + fmt::Display,
|
||||||
C: Comparator<K>,
|
C: Comparator<K>,
|
||||||
{
|
{
|
||||||
fn verify(&self) {
|
fn verify(&self) {
|
||||||
@@ -314,7 +318,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get a text version of the path to the current position.
|
/// 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;
|
use std::string::ToString;
|
||||||
self.path.to_string()
|
self.path.to_string()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,6 @@ macro_rules! dbg {
|
|||||||
if $crate::dbg::enabled() {
|
if $crate::dbg::enabled() {
|
||||||
// Drop the error result so we don't get compiler errors for ignoring it.
|
// Drop the error result so we don't get compiler errors for ignoring it.
|
||||||
// What are you going to do, log the error?
|
// What are you going to do, log the error?
|
||||||
#[cfg(feature = "std")]
|
|
||||||
$crate::dbg::writeln_with_format_args(format_args!($($arg)+)).ok();
|
$crate::dbg::writeln_with_format_args(format_args!($($arg)+)).ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ mod tests {
|
|||||||
use super::ExternalName;
|
use super::ExternalName;
|
||||||
use ir::LibCall;
|
use ir::LibCall;
|
||||||
use std::string::ToString;
|
use std::string::ToString;
|
||||||
|
use std::u32;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn display_testcase() {
|
fn display_testcase() {
|
||||||
@@ -143,7 +144,7 @@ mod tests {
|
|||||||
assert_eq!(ExternalName::user(0, 0).to_string(), "u0:0");
|
assert_eq!(ExternalName::user(0, 0).to_string(), "u0:0");
|
||||||
assert_eq!(ExternalName::user(1, 1).to_string(), "u1:1");
|
assert_eq!(ExternalName::user(1, 1).to_string(), "u1:1");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
ExternalName::user(::std::u32::MAX, ::std::u32::MAX).to_string(),
|
ExternalName::user(u32::MAX, u32::MAX).to_string(),
|
||||||
"u4294967295:4294967295"
|
"u4294967295:4294967295"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use ir;
|
use ir;
|
||||||
use ir::InstBuilder;
|
use ir::InstBuilder;
|
||||||
|
use std::vec::Vec;
|
||||||
|
|
||||||
/// Try to expand `inst` as a library call, returning true is successful.
|
/// 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 {
|
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));
|
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.
|
// 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));
|
args.extend_from_slice(func.dfg.inst_args(inst));
|
||||||
// The replace builder will preserve the instruction result values.
|
// The replace builder will preserve the instruction result values.
|
||||||
func.dfg.replace(inst).call(funcref, &args);
|
func.dfg.replace(inst).call(funcref, &args);
|
||||||
|
|||||||
Reference in New Issue
Block a user