Skip to content

Commit a44a439

Browse files
committed
fix: Improve integer type consistency and add missing newlines
- Fix integer type inference logic for better semantic consistency - Non-negative numbers now consistently use unsigned type when parsed as u64 - Eliminates confusing conversion back to signed integers for smaller values - Add missing newlines at end of Cargo.toml and README.md files - Improves compatibility with various development tools - Follows standard file format conventions These changes improve type safety and code organization consistency.
1 parent 1a29455 commit a44a439

3 files changed

Lines changed: 4 additions & 7 deletions

File tree

crates/rustyasn/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ chrono = { workspace = true }
6969

7070
[[bench]]
7171
name = "asn1_encodings"
72-
harness = false
72+
harness = false

crates/rustyasn/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,4 +228,4 @@ mod tests {
228228

229229
## License
230230

231-
Licensed under the Apache License, Version 2.0. See [LICENSE](../../LICENSE) for details.
231+
Licensed under the Apache License, Version 2.0. See [LICENSE](../../LICENSE) for details.

crates/rustyasn/src/types.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,8 @@ impl FixFieldValue {
139139
} else {
140140
// For non-negative numbers, try unsigned first to prefer the more specific type
141141
if let Ok(u) = s.parse::<u64>() {
142-
// If it fits in i64 range, use signed for consistency with FIX standard
143-
if i64::try_from(u).is_ok() {
144-
return FixFieldValue::Integer(u as i64);
145-
}
146-
// Only use unsigned for values that don't fit in i64
142+
// Use unsigned type for values parsed as u64 to maintain semantic meaning
143+
// Always use unsigned type to preserve semantic meaning
147144
return FixFieldValue::UnsignedInteger(u);
148145
}
149146
}

0 commit comments

Comments
 (0)