Skip to content

Commit

Permalink
Add removal of unused temporary variables
Browse files Browse the repository at this point in the history
Ref. None
  • Loading branch information
treiher committed Jul 10, 2024
1 parent 3ecdfd0 commit 7083155
Show file tree
Hide file tree
Showing 5 changed files with 475 additions and 17 deletions.
15 changes: 14 additions & 1 deletion librapidflux/src/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::fmt::Display;
use serde::{Deserialize, Serialize};

#[must_use]
#[derive(Clone, PartialEq, Serialize, Deserialize)]
#[derive(Clone, PartialEq, Serialize, Deserialize, Debug)]
pub struct Bounds {
lower: i128,
upper: i128,
Expand Down Expand Up @@ -113,4 +113,17 @@ mod tests {
assert_eq!(result.lower, expected.lower);
assert_eq!(result.upper, expected.upper);
}

#[test]
fn test_bounds_serde() {
let bounds = Bounds::new(1, 2);
let bytes = bincode::serialize(&bounds).expect("failed to serialize");
let deserialized_bounds = bincode::deserialize(&bytes).expect("failed to deserialize");
assert_eq!(bounds, deserialized_bounds);
}

#[test]
fn test_bounds_display() {
assert_eq!(Bounds::new(1, 2).to_string(), "1 .. 2");
}
}
6 changes: 4 additions & 2 deletions rflx/identifier.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
from __future__ import annotations

from collections.abc import Generator
from typing import Union
from typing import Final, Union

from rflx.rapidflux import ID as ID

StrID = Union[str, ID]

ID_PREFIX: Final = "T_"


def id_generator() -> Generator[ID, None, None]:
i = 0
while True:
yield ID(f"T_{i}")
yield ID(f"{ID_PREFIX}{i}")
i += 1
Loading

0 comments on commit 7083155

Please sign in to comment.