@@ -2412,9 +2412,62 @@ Require a specific version of rustfmt. If you want to make sure that the
24122412specific version of rustfmt is used in your CI, use this option.
24132413
24142414- ** Default value** : ` CARGO_PKG_VERSION `
2415- - ** Possible values** : any published version (e.g. ` "0.3.8" ` )
2415+ - ** Possible values** : ` semver ` compliant values, such as defined on [ semver.org ] ( https://semver.org/ ) .
24162416- ** Stable** : No (tracking issue: [ #3386 ] ( https://github.com/rust-lang/rustfmt/issues/3386 ) )
24172417
2418+ #### Match on exact version:
2419+
2420+ ``` toml
2421+ required_version =" 1.0.0"
2422+ ```
2423+
2424+ #### Higher or equal to:
2425+
2426+ ``` toml
2427+ required_version =" >=1.0.0"
2428+ ```
2429+
2430+ #### Lower or equal to:
2431+
2432+ ``` toml
2433+ required_version =" <=1.0.0"
2434+ ```
2435+
2436+ #### New minor or patch versions:
2437+
2438+ ``` toml
2439+ required_version =" ^1.0.0"
2440+ ```
2441+
2442+ #### New patch versions:
2443+
2444+ ``` toml
2445+ required_version =" ~1.0.0"
2446+ ```
2447+
2448+ #### Wildcard:
2449+
2450+ ``` toml
2451+ required_version =" *" # matches any version.
2452+ required_version =" 1.*" # matches any version with the same major version
2453+ required_version =" 1.0.*" # matches any version with the same major and minor version
2454+ ```
2455+
2456+ #### Multiple versions to match:
2457+
2458+ A comma separated list of version requirements.
2459+ The match succeeds when the current rustfmt version matches all version requirements.
2460+
2461+ The one notable exception is that a wildcard matching any version cannot be used in the list.
2462+ For example, ` *, <1.0.0 ` will always fail.
2463+
2464+ Additionally, the version match will always fail if any of the version requirements contradict themselves.
2465+ Some examples of contradictory requirements are ` 1.*, >2.0.0 ` , ` 1.0.*, >2.0.0 ` and ` <1.5.0, >1.10.* ` .
2466+
2467+ ``` toml
2468+ required_version =" >=1.0.0, <2.0.0"
2469+ ```
2470+
24182471## ` short_array_element_width_threshold `
24192472
24202473The width threshold for an array element to be considered "short".
0 commit comments