Skip to content

Conversation

@prestoalvarez
Copy link
Contributor

Changes:

  • Add version_without_build and normalize_compiler_version_str in crates/verify/src/utils.rs.
  • Use shared helpers in utils.rs and etherscan/mod.rs instead of inline parsing.

Removes duplicated logic (split by '+' and trim leading 'v'), reducing maintenance risk and keeping behavior

Comment on lines 62 to 68
pub fn version_without_build(version: &str) -> String {
version.split('+').next().unwrap_or("").to_string()
}

pub fn normalize_compiler_version_str(version: &str) -> String {
version_without_build(version).trim_start_matches('v').to_string()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are only used in this crate, so please do not mark them pub.

please also add a small doc comment explaining what they do so you don't need to look up the fn definition

Comment on lines 62 to 63
pub fn version_without_build(version: &str) -> String {
version.split('+').next().unwrap_or("").to_string()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems like it should just be an Option<_> since all we do is check if it's empty and then provide a better default.

@onbjerg onbjerg self-assigned this Nov 4, 2025
@prestoalvarez prestoalvarez requested a review from onbjerg November 4, 2025 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants