Skip to content

Commit

Permalink
chore: Fix some unstable lints (#971)
Browse files Browse the repository at this point in the history
Fix some lints that appear when compiling on nightly.
These are mostly double-import warnings due to importing things already
included by `use super::*`.
  • Loading branch information
aborgna-q authored Apr 30, 2024
1 parent d913f40 commit fb76c7e
Show file tree
Hide file tree
Showing 18 changed files with 21 additions and 34 deletions.
4 changes: 2 additions & 2 deletions hugr/src/algorithm/const_fold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ mod test {

use super::*;
use crate::extension::prelude::{sum_with_error, BOOL_T};
use crate::extension::{ExtensionRegistry, PRELUDE};
use crate::ops::{OpType, UnpackTuple};
use crate::extension::PRELUDE;
use crate::ops::UnpackTuple;
use crate::std_extensions::arithmetic;
use crate::std_extensions::arithmetic::conversions::ConvertOpDef;
use crate::std_extensions::arithmetic::float_ops::FloatOps;
Expand Down
4 changes: 2 additions & 2 deletions hugr/src/algorithm/nest_cfgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,10 +579,10 @@ pub(crate) mod test {
use crate::extension::{prelude::USIZE_T, ExtensionSet};

use crate::hugr::views::RootChecked;
use crate::ops::handle::{BasicBlockID, ConstID, NodeHandle};
use crate::ops::handle::{ConstID, NodeHandle};
use crate::ops::Value;
use crate::type_row;
use crate::types::{FunctionType, Type};
use crate::{type_row, Hugr};
const NAT: Type = USIZE_T;

pub fn group_by<E: Eq + Hash + Ord, V: Eq + Hash>(h: HashMap<E, V>) -> HashSet<Vec<E>> {
Expand Down
1 change: 0 additions & 1 deletion hugr/src/builder/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ impl BlockBuilder<Hugr> {

#[cfg(test)]
pub(crate) mod test {
use crate::builder::build_traits::HugrBuilder;
use crate::builder::{DataflowSubContainer, ModuleBuilder};

use crate::hugr::validate::InterGraphEdgeError;
Expand Down
2 changes: 1 addition & 1 deletion hugr/src/builder/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ mod test {
use crate::{
builder::{
test::{build_main, NAT, QB},
Dataflow, DataflowSubContainer, Wire,
DataflowSubContainer,
},
extension::prelude::BOOL_T,
ops::{custom::OpaqueOp, CustomOp},
Expand Down
3 changes: 1 addition & 2 deletions hugr/src/builder/conditional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,13 @@ impl CaseBuilder<Hugr> {
mod test {
use cool_asserts::assert_matches;

use crate::builder::{DataflowSubContainer, HugrBuilder, ModuleBuilder};
use crate::builder::{DataflowSubContainer, ModuleBuilder};

use crate::{
builder::{
test::{n_identity, NAT},
Dataflow,
},
extension::ExtensionSet,
ops::Value,
type_row,
};
Expand Down
6 changes: 1 addition & 5 deletions hugr/src/builder/dataflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,7 @@ pub(crate) mod test {
use crate::types::Type;
use crate::utils::test_quantum_extension::h_gate;
use crate::{
builder::{
test::{n_identity, BIT, NAT, QB},
BuildError,
},
extension::ExtensionSet,
builder::test::{n_identity, BIT, NAT, QB},
type_row, Wire,
};

Expand Down
2 changes: 1 addition & 1 deletion hugr/src/builder/tail_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ mod test {
extension::ExtensionSet,
hugr::ValidationError,
ops::Value,
type_row, Hugr,
type_row,
};

use super::*;
Expand Down
4 changes: 2 additions & 2 deletions hugr/src/extension/infer/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use super::*;
use crate::builder::{
Container, DFGBuilder, Dataflow, DataflowHugr, DataflowSubContainer, HugrBuilder, ModuleBuilder,
};
use crate::extension::prelude::PRELUDE_REGISTRY;
use crate::extension::prelude::QB_T;
use crate::extension::ExtensionId;
use crate::extension::{prelude::PRELUDE_REGISTRY, ExtensionSet};
use crate::hugr::{Hugr, HugrMut, HugrView, NodeType};
use crate::hugr::{Hugr, HugrMut, NodeType};
use crate::macros::const_extension_ids;
use crate::ops::custom::OpaqueOp;
use crate::ops::{self, dataflow::IOTrait};
Expand Down
1 change: 0 additions & 1 deletion hugr/src/extension/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ impl CustomConst for ConstError {
mod test {
use crate::{
builder::{DFGBuilder, Dataflow, DataflowHugr},
types::FunctionType,
Hugr, Wire,
};

Expand Down
1 change: 1 addition & 0 deletions hugr/src/hugr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ mod test {
fn impls_send_and_sync() {
// Send and Sync are automatically impl'd by the compiler, if possible.
// This test will fail to compile if that wasn't possible.
#[allow(dead_code)]
trait Test: Send + Sync {}
impl Test for Hugr {}
}
Expand Down
1 change: 0 additions & 1 deletion hugr/src/hugr/rewrite/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ mod test {
prelude::{ConstUsize, USIZE_T},
PRELUDE_REGISTRY,
},
hugr::HugrMut,
ops::{handle::NodeHandle, MakeTuple, Value},
type_row,
types::FunctionType,
Expand Down
2 changes: 1 addition & 1 deletion hugr/src/hugr/rewrite/insert_identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ mod tests {
algorithm::nest_cfgs::test::build_conditional_in_loop_cfg,
extension::{prelude::QB_T, PRELUDE_REGISTRY},
ops::handle::NodeHandle,
Hugr, HugrView,
Hugr,
};

#[rstest]
Expand Down
8 changes: 4 additions & 4 deletions hugr/src/hugr/validate/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ use crate::builder::{
use crate::extension::prelude::{BOOL_T, PRELUDE, USIZE_T};
use crate::extension::{Extension, ExtensionId, TypeDefBound, EMPTY_REG, PRELUDE_REGISTRY};
use crate::hugr::hugrmut::sealed::HugrMutInternals;
use crate::hugr::{HugrMut, NodeType};
use crate::hugr::HugrMut;
use crate::ops::dataflow::IOTrait;
use crate::ops::{self, Noop, OpType, Value};
use crate::ops::{self, Noop, Value};
use crate::std_extensions::logic::test::{and_op, or_op};
use crate::std_extensions::logic::{self, NotOp};
use crate::types::type_param::{TypeArg, TypeArgError, TypeParam};
use crate::types::type_param::{TypeArg, TypeArgError};
use crate::types::{CustomType, FunctionType, PolyFuncType, Type, TypeBound, TypeRow};
use crate::{type_row, Direction, IncomingPort, Node};
use crate::{type_row, IncomingPort};

const NAT: Type = crate::extension::prelude::USIZE_T;

Expand Down
1 change: 0 additions & 1 deletion hugr/src/hugr/views/descendants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ where
pub(super) mod test {
use crate::{
builder::{Container, Dataflow, DataflowSubContainer, HugrBuilder, ModuleBuilder},
ops::handle::NodeHandle,
type_row,
types::{FunctionType, Type},
utils::test_quantum_extension::h_gate,
Expand Down
1 change: 0 additions & 1 deletion hugr/src/hugr/views/sibling_subgraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,6 @@ mod tests {
EMPTY_REG,
},
hugr::views::{HierarchyView, SiblingGraph},
hugr::HugrMut,
ops::handle::{DfgID, FuncID, NodeHandle},
std_extensions::logic::{test::and_op, NotOp},
type_row,
Expand Down
3 changes: 1 addition & 2 deletions hugr/src/ops/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,10 @@ mod test {
prelude::{ConstUsize, USIZE_CUSTOM_T, USIZE_T},
ExtensionId, ExtensionRegistry, PRELUDE,
},
ops::constant::CustomSerialized,
std_extensions::arithmetic::float_types::{self, ConstF64, FLOAT64_TYPE},
type_row,
types::type_param::TypeArg,
types::{CustomType, FunctionType, Type, TypeBound, TypeRow},
types::{Type, TypeBound, TypeRow},
};
use cool_asserts::assert_matches;
use rstest::{fixture, rstest};
Expand Down
7 changes: 3 additions & 4 deletions hugr/src/std_extensions/collections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,14 @@ impl ListOpInst {

#[cfg(test)]
mod test {
use crate::ops::OpTrait;
use crate::{
extension::{
prelude::{ConstUsize, QB_T, USIZE_T},
ExtensionRegistry, PRELUDE,
PRELUDE,
},
ops::OpTrait,
std_extensions::arithmetic::float_types::{self, ConstF64, FLOAT64_TYPE},
types::{type_param::TypeArg, TypeRow},
Extension,
types::TypeRow,
};

use super::*;
Expand Down
4 changes: 1 addition & 3 deletions hugr/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,7 @@ pub(crate) fn check_typevar_decl(
#[cfg(test)]
pub(crate) mod test {
use super::*;
use crate::{extension::prelude::USIZE_T, ops::AliasDecl};

use crate::types::TypeBound;
use crate::extension::prelude::USIZE_T;

#[test]
fn construct() {
Expand Down

0 comments on commit fb76c7e

Please sign in to comment.