Skip to content

Commit

Permalink
chore: Fix lints from clippy 1.82
Browse files Browse the repository at this point in the history
  • Loading branch information
aborgna-q committed Oct 14, 2024
1 parent 6c425ee commit ee9e6ce
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions hugr-core/src/builder/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use crate::{CircuitUnit, Wire};

/// Builder to build regions of dataflow graphs that look like Circuits,
/// where some inputs of operations directly correspond to some outputs.
///
/// Allows appending operations by indexing a vector of input wires.
#[derive(Debug, PartialEq)]
pub struct CircuitBuilder<'a, T: ?Sized> {
Expand Down
5 changes: 3 additions & 2 deletions hugr-core/src/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,9 @@ pub enum ExtensionBuildError {
pub struct ExtensionSet(BTreeSet<ExtensionId>);

/// A special ExtensionId which indicates that the delta of a non-Function
/// container node should be computed by extension inference. See [`infer_extensions`]
/// which lists the container nodes to which this can be applied.
/// container node should be computed by extension inference.
///
/// See [`infer_extensions`] which lists the container nodes to which this can be applied.
///
/// [`infer_extensions`]: crate::hugr::Hugr::infer_extensions
pub const TO_BE_INFERRED: ExtensionId = ExtensionId::new_unchecked(".TO_BE_INFERRED");
Expand Down
1 change: 1 addition & 0 deletions hugr-core/src/extension/simple_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ where

/// Traits implemented by types which can add themselves to [`Extension`]s as
/// [`OpDef`]s or load themselves from an [`OpDef`].
///
/// Particularly useful with C-style enums that implement [strum::IntoEnumIterator],
/// as then all definitions can be added to an extension at once.
pub trait MakeOpDef: NamedOp {
Expand Down
2 changes: 2 additions & 0 deletions hugr-core/src/ops/constant/custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ pub trait CustomConst:
fn get_type(&self) -> Type;
}

/// Fallible hash function.
///
/// Prerequisite for `CustomConst`. Allows to declare a custom hash function,
/// but the easiest options are either to `impl TryHash for ... {}` to indicate
/// "not hashable", or else to implement/derive [Hash].
Expand Down
1 change: 1 addition & 0 deletions hugr-core/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ impl<RV: MaybeRV> TypeEnum<RV> {
try_from = "serialize::SerSimpleType"
)]
/// A HUGR type - the valid types of [EdgeKind::Value] and [EdgeKind::Const] edges.
///
/// Such an edge is valid if the ports on either end agree on the [Type].
/// Types have an optional [TypeBound] which places limits on the valid
/// operations on a type.
Expand Down
5 changes: 3 additions & 2 deletions hugr-passes/src/const_fold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ fn const_graph(consts: Vec<Value>, reg: &ExtensionRegistry) -> Hugr {
}

/// Given some `candidate_nodes` to search for LoadConstant operations in `hugr`,
/// return an iterator of possible constant folding rewrites. The
/// [`SimpleReplacement`] replaces an operation with constants that result from
/// return an iterator of possible constant folding rewrites.
///
/// The [`SimpleReplacement`] replaces an operation with constants that result from
/// evaluating it, the extension registry `reg` is used to validate the
/// replacement HUGR. The vector of [`RemoveLoadConstant`] refer to the
/// LoadConstant nodes that could be removed - they are not automatically
Expand Down
2 changes: 2 additions & 0 deletions hugr-passes/src/nest_cfgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ use hugr_core::{Direction, Hugr, Node};

/// A "view" of a CFG in a Hugr which allows basic blocks in the underlying CFG to be split into
/// multiple blocks in the view (or merged together).
///
/// `T` is the type of basic block; this can just be a BasicBlock (e.g. [`Node`]) in the Hugr,
/// or an [IdentityCfgMap] if the extra level of indirection is not required. However, since
/// SESE regions are bounded by edges between pairs of such `T`, such splitting may allow the
Expand Down Expand Up @@ -153,6 +154,7 @@ pub fn transform_cfg_to_nested<T: Copy + Eq + Hash + std::fmt::Debug>(

/// Search the entire Hugr looking for CFGs, and transform each
/// into as deeply-nested form as possible (as per [transform_cfg_to_nested]).
///
/// This search may be expensive, although if it finds much/many CFGs,
/// the analysis/transformation on them is likely to be more expensive still!
pub fn transform_all_cfgs(h: &mut Hugr) {
Expand Down

0 comments on commit ee9e6ce

Please sign in to comment.