Skip to main content

match_v_prefix_style

Function match_v_prefix_style 

Source
pub fn match_v_prefix_style(current: &str, tag: &str) -> String
Expand description

Rewrites tag to match current’s leading v/V prefix style (or lack of one).

A repository/project can change its tagging convention over time (4.0.0 -> v5.0.0); a formatted replacement should still read naturally against the user’s existing pin style rather than silently flipping it.

§Examples

use deps_core::lsp_helpers::match_v_prefix_style;

assert_eq!(match_v_prefix_style("v4", "5.0.0"), "v5.0.0");
assert_eq!(match_v_prefix_style("4", "v5.0.0"), "5.0.0");