From 39b142edace72321a0cf0b6b38a17e9d5f21d6df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Borgna?= Date: Thu, 28 Nov 2024 14:21:02 +0000 Subject: [PATCH] chore: Fix new lints in Rust 1.83 --- tket2-hseries/src/extension/futures.rs | 2 +- tket2-hseries/src/extension/result.rs | 2 +- tket2-py/examples/utils/__init__.py | 2 +- tket2/src/circuit/command.rs | 16 ++++++++-------- tket2/src/optimiser/badger/log.rs | 2 +- tket2/tests/badger_termination.rs | 1 + uv.lock | 4 ++-- 7 files changed, 15 insertions(+), 14 deletions(-) diff --git a/tket2-hseries/src/extension/futures.rs b/tket2-hseries/src/extension/futures.rs index 5cfe86cc..6b6fece2 100644 --- a/tket2-hseries/src/extension/futures.rs +++ b/tket2-hseries/src/extension/futures.rs @@ -148,7 +148,7 @@ impl HasConcrete for FutureOpDef { } } -impl<'a> From<&'a FutureOp> for &'static str { +impl From<&FutureOp> for &'static str { fn from(value: &FutureOp) -> Self { value.op.into() } diff --git a/tket2-hseries/src/extension/result.rs b/tket2-hseries/src/extension/result.rs index ac7f8910..e9f309b7 100644 --- a/tket2-hseries/src/extension/result.rs +++ b/tket2-hseries/src/extension/result.rs @@ -319,7 +319,7 @@ fn concrete_result_op_type_args( } } -impl<'a> From<&'a ResultOp> for &'static str { +impl From<&ResultOp> for &'static str { fn from(value: &ResultOp) -> Self { value.result_op.into() } diff --git a/tket2-py/examples/utils/__init__.py b/tket2-py/examples/utils/__init__.py index 4bab9670..9600f8bb 100644 --- a/tket2-py/examples/utils/__init__.py +++ b/tket2-py/examples/utils/__init__.py @@ -32,7 +32,7 @@ def guppy_to_circuit(func_def: RawFunctionDef) -> Tk2Circuit: pkg = module.compile() - json = pkg.to_json() + json = pkg.package.to_json() circ = Tk2Circuit.from_package_json(json, func_def.name) return lower_to_pytket(circ) diff --git a/tket2/src/circuit/command.rs b/tket2/src/circuit/command.rs index 901505e5..7fdba670 100644 --- a/tket2/src/circuit/command.rs +++ b/tket2/src/circuit/command.rs @@ -163,7 +163,7 @@ impl<'circ, T: HugrView> Command<'circ, T> { } } -impl<'a, 'circ, T: HugrView> UnitLabeller for &'a Command<'circ, T> { +impl UnitLabeller for &Command<'_, T> { #[inline] fn assign_linear(&self, _: Node, port: Port, _linear_count: usize) -> LinearUnit { let units = match port.direction() { @@ -190,7 +190,7 @@ impl<'a, 'circ, T: HugrView> UnitLabeller for &'a Command<'circ, T> { } } -impl<'circ, T: HugrView> std::fmt::Debug for Command<'circ, T> { +impl std::fmt::Debug for Command<'_, T> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("Command") .field("circuit name", &self.circ.name()) @@ -201,7 +201,7 @@ impl<'circ, T: HugrView> std::fmt::Debug for Command<'circ, T> { } } -impl<'circ, T: HugrView> PartialEq for Command<'circ, T> { +impl PartialEq for Command<'_, T> { fn eq(&self, other: &Self) -> bool { self.node == other.node && self.input_linear_units == other.input_linear_units @@ -209,9 +209,9 @@ impl<'circ, T: HugrView> PartialEq for Command<'circ, T> { } } -impl<'circ, T: HugrView> Eq for Command<'circ, T> {} +impl Eq for Command<'_, T> {} -impl<'circ, T: HugrView> Clone for Command<'circ, T> { +impl Clone for Command<'_, T> { fn clone(&self) -> Self { Self { circ: self.circ, @@ -222,7 +222,7 @@ impl<'circ, T: HugrView> Clone for Command<'circ, T> { } } -impl<'circ, T: HugrView> std::hash::Hash for Command<'circ, T> { +impl std::hash::Hash for Command<'_, T> { fn hash(&self, state: &mut H) { self.node.hash(state); self.input_linear_units.hash(state); @@ -460,9 +460,9 @@ impl<'circ, T: HugrView> Iterator for CommandIterator<'circ, T> { } } -impl<'circ, T: HugrView> FusedIterator for CommandIterator<'circ, T> {} +impl FusedIterator for CommandIterator<'_, T> {} -impl<'circ, T: HugrView> std::fmt::Debug for CommandIterator<'circ, T> { +impl std::fmt::Debug for CommandIterator<'_, T> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("CommandIterator") .field("circuit name", &self.circ.name()) diff --git a/tket2/src/optimiser/badger/log.rs b/tket2/src/optimiser/badger/log.rs index c24fe379..b11b80fa 100644 --- a/tket2/src/optimiser/badger/log.rs +++ b/tket2/src/optimiser/badger/log.rs @@ -11,7 +11,7 @@ pub struct BadgerLogger<'w> { branching_factor: UsizeAverage, } -impl<'w> Default for BadgerLogger<'w> { +impl Default for BadgerLogger<'_> { fn default() -> Self { Self { circ_candidates_csv: Default::default(), diff --git a/tket2/tests/badger_termination.rs b/tket2/tests/badger_termination.rs index 4d15857a..8347c99b 100644 --- a/tket2/tests/badger_termination.rs +++ b/tket2/tests/badger_termination.rs @@ -1,3 +1,4 @@ +//! Tests for the Badger optimiser termination conditions. #![cfg(feature = "portmatching")] use rstest::{fixture, rstest}; diff --git a/uv.lock b/uv.lock index a11c8bb6..5d522b29 100644 --- a/uv.lock +++ b/uv.lock @@ -790,7 +790,7 @@ wheels = [ [[package]] name = "tket2" -version = "0.4.1" +version = "0.5.0" source = { editable = "tket2-py" } dependencies = [ { name = "hugr" }, @@ -814,7 +814,7 @@ source = { editable = "tket2-eccs" } [[package]] name = "tket2-exts" -version = "0.1.0" +version = "0.1.1" source = { editable = "tket2-exts" } dependencies = [ { name = "hugr" },