diff --git a/lib/modules/versioning/cargo/index.spec.ts b/lib/modules/versioning/cargo/index.spec.ts index d4e6c33ce147abdc0b2c066fc750a88ccb8b2e38..beb92118f248e02ef861391f5093fb8d3cc2a698 100644 --- a/lib/modules/versioning/cargo/index.spec.ts +++ b/lib/modules/versioning/cargo/index.spec.ts @@ -92,6 +92,16 @@ describe('modules/versioning/cargo/index', () => { test.each` currentValue | rangeStrategy | currentVersion | newVersion | expected + ${'*'} | ${'pin'} | ${'1.0.0'} | ${'1.0.0'} | ${'=1.0.0'} + ${'1'} | ${'pin'} | ${'1.0.0'} | ${'1.0.0'} | ${'=1.0.0'} + ${'1.0'} | ${'pin'} | ${'1.0.0'} | ${'1.0.0'} | ${'=1.0.0'} + ${'1.0.0'} | ${'pin'} | ${'1.0.0'} | ${'1.0.0'} | ${'=1.0.0'} + ${'^1'} | ${'pin'} | ${'1.0.0'} | ${'1.0.0'} | ${'=1.0.0'} + ${'^1.0'} | ${'pin'} | ${'1.0.0'} | ${'1.0.0'} | ${'=1.0.0'} + ${'^1.0.0'} | ${'pin'} | ${'1.0.0'} | ${'1.0.0'} | ${'=1.0.0'} + ${'~1'} | ${'pin'} | ${'1.0.0'} | ${'1.0.0'} | ${'=1.0.0'} + ${'~1.0'} | ${'pin'} | ${'1.0.0'} | ${'1.0.0'} | ${'=1.0.0'} + ${'~1.0.0'} | ${'pin'} | ${'1.0.0'} | ${'1.0.0'} | ${'=1.0.0'} ${null} | ${'bump'} | ${'1.0.0'} | ${'1.1.0'} | ${null} ${'*'} | ${'bump'} | ${'1.0.0'} | ${'1.1.0'} | ${'*'} ${'=1.0.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.0'} | ${'=1.1.0'} diff --git a/lib/modules/versioning/cargo/index.ts b/lib/modules/versioning/cargo/index.ts index c18b1ea625eba904b2eedfabace9c92891ed8fed..52562646f3774a3815271b64a47f9fe57b9e8628 100644 --- a/lib/modules/versioning/cargo/index.ts +++ b/lib/modules/versioning/cargo/index.ts @@ -94,7 +94,7 @@ function getNewValue({ newVersion, }: NewValueConfig): string { if (!currentValue || currentValue === '*') { - return currentValue; + return rangeStrategy === 'pin' ? `=${newVersion}` : currentValue; } if (rangeStrategy === 'pin' || isSingleVersion(currentValue)) { let res = '=';