Skip to content

Commit 1ee1022

Browse files
Merge pull request #1456 from andyleejordan/ignore-msrustup
Fix local use of `msrustup`
2 parents 7985e50 + 9c20450 commit 1ee1022

File tree

7 files changed

+118
-118
lines changed

7 files changed

+118
-118
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
msrustup
1+
msrustup*
22
build/
33
target/
44
bin/

build.ps1

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,6 @@ process {
190190
Update-Rust @VerboseParam
191191
}
192192

193-
if (!$usingADO) {
194-
Write-BuildProgress @progressParams -Status 'Setting RustUp to default channel'
195-
$rustup, $channel = Get-RustUp @VerboseParam
196-
& $rustup default stable
197-
}
198-
199193
if ($Clippy) {
200194
Write-BuildProgress @progressParams -Status 'Ensuring Clippy is available and updated'
201195
Install-Clippy -UseCFS:$UseCFS -Architecture $Architecture @VerboseParam

helpers.build.psm1

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,8 @@ function Update-Rust {
435435

436436
Write-Verbose -Verbose "Rust found, updating..."
437437
$rustup, $channel = Get-RustUp
438+
& $rustup toolchain install $channel
439+
& $rustup default $channel
438440
& $rustup update
439441
}
440442
}
@@ -581,17 +583,27 @@ function Install-Clippy {
581583
$Architecture = 'current'
582584
)
583585

586+
begin {
587+
}
588+
584589
process {
585590
Write-Verbose -Verbose "Installing clippy..."
586591
if ($UseCFS) {
587592
cargo install clippy --config .cargo/config.toml
588593
} else {
594+
$rustup, $channel = Get-RustUp
595+
596+
if ($rustup -eq 'msrustup') {
597+
Write-Verbose -Verbose "Clippy is already included with msrustup"
598+
return
599+
}
600+
589601
if ($Architecture -ne 'current') {
590602
write-verbose -verbose "Installing clippy for $Architecture"
591-
rustup component add clippy --target $Architecture
603+
& $rustup component add clippy --target $Architecture
592604
} else {
593605
write-verbose -verbose "Installing clippy for current architecture"
594-
rustup component add clippy
606+
& $rustup component add clippy
595607
}
596608
}
597609
if ($LASTEXITCODE -ne 0) {
@@ -793,24 +805,6 @@ function Install-PowerShellTestPrerequisite {
793805
#endregion Install tools functions
794806

795807
#region Environment setup utility functions
796-
function Set-RustChannel {
797-
<#
798-
.SYNOPSIS
799-
Sets the rust default toolchain to the stable channel.
800-
#>
801-
802-
[CmdletBinding()]
803-
param()
804-
805-
begin {
806-
$rustup, $channel = Get-RustUp
807-
}
808-
809-
process {
810-
& $rustup default stable
811-
}
812-
}
813-
814808
function Set-CargoEnvironment {
815809
<#
816810
.SYNOPSIS

lib/dsc-lib/src/types/date_version.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4+
// TODO: Remove when updating to rustc 1.94; false positive from thiserror + rust-i18n t!() macro
5+
#![allow(unused_assignments)]
6+
47
use std::{
58
fmt::Display,
69
str::FromStr,

lib/dsc-lib/src/types/fully_qualified_type_name.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4+
// TODO: Remove when updating to rustc 1.94; false positive from thiserror + rust-i18n t!() macro
5+
#![allow(unused_assignments)]
6+
47
use std::fmt::{Display, Formatter};
58
use std::hash::Hash;
69
use std::ops::Deref;
@@ -223,7 +226,7 @@ pub enum FullyQualifiedTypeNameError {
223226
///
224227
/// If the fully qualified type name contains any empty namespace segments, validation raises
225228
/// this error in the `errors` field of the main [`InvalidTypeName`] error.
226-
///
229+
///
227230
/// [`InvalidTypeName`]: Self::InvalidTypeName
228231
#[error("{t}", t = t!(
229232
"types.fully_qualified_type_name.emptyNamespaceSegment",
@@ -384,7 +387,7 @@ impl FullyQualifiedTypeName {
384387
/// }
385388
/// );
386389
/// ```
387-
///
390+
///
388391
/// - An empty namespace segment is not valid.
389392
///
390393
/// ```rust
@@ -437,21 +440,21 @@ impl FullyQualifiedTypeName {
437440

438441
/// Private helper to parse the input into segments and collect validation errors for owner
439442
/// and namespace segments.
440-
///
443+
///
441444
/// This is used by the public `parse()` method to handle the common parsing and validation
442445
/// logic that is shared by [`FullyQualifiedTypeName`] and [`WildcardTypeName`] since they
443446
/// share the same overall structure.
444-
///
447+
///
445448
/// # Arguments
446-
///
449+
///
447450
/// - `text`: The input string to parse into type name segments.
448451
/// - `validating_segment_regex`: The regex to use for validating each segment of the type name.
449452
/// - `errors`: A mutable reference to a vector for collecting any validation errors encountered
450453
/// while parsing the segments. This allows the method to accumulate multiple errors for
451454
/// different segments of the type name.
452-
///
455+
///
453456
/// # Returns
454-
///
457+
///
455458
/// The method returns the parsed segments (`owner`, `namespaces`, and `name`) as a tuple. Any
456459
/// validation errors encountered during parsing are added to the provided `errors` vector for
457460
/// the caller to handle.
@@ -535,7 +538,7 @@ impl FullyQualifiedTypeName {
535538
/// number of `namespace` segments, which must be separated from the previous segment by a
536539
/// single period (`.`). Finally, the string must include a forward slash (`/`) followed by one
537540
/// or more unicode alphanumeric characters and underscores to define the `name` segment.
538-
///
541+
///
539542
/// [`VALIDATING_SEGMENT_PATTERN`]: Self::VALIDATING_SEGMENT_PATTERN
540543
pub const VALIDATING_PATTERN: &str = r"^\w+(\.\w+)*\/\w+$";
541544

lib/dsc-lib/src/types/semantic_version_req.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4+
// TODO: Remove when updating to rustc 1.94; false positive from thiserror + rust-i18n t!() macro
5+
#![allow(unused_assignments)]
6+
47
use std::{fmt::Display, ops::Deref, str::FromStr, sync::OnceLock};
58

69
use miette::Diagnostic;
@@ -688,28 +691,28 @@ impl SemanticVersionReq {
688691
/// // 2.0.0 isn't compatible with the requirement.
689692
/// assert!(!requirement.matches(&SemanticVersion::new(2, 0, 0)));
690693
/// ```
691-
///
694+
///
692695
/// The following example shows how the `matches` function treats prerelease versions as not
693696
/// matching a requirement unless the requirement explicitly defines a prerelease segment.
694-
///
697+
///
695698
/// ```rust
696699
/// # use dsc_lib::types::{SemanticVersion, SemanticVersionReq};
697700
/// let v_stable = &SemanticVersion::parse("1.2.3").unwrap();
698701
/// let v_rc1 = &SemanticVersion::parse("1.2.3-rc.1").unwrap();
699702
/// let v_rc2 = &SemanticVersion::parse("1.2.3-rc.2").unwrap();
700-
///
701-
/// // Only the stable version matches the stable requirement
703+
///
704+
/// // Only the stable version matches the stable requirement
702705
/// let stable_req = SemanticVersionReq::parse("^1.2.3").unwrap();
703706
/// assert!(!stable_req.matches(v_rc1));
704707
/// assert!(!stable_req.matches(v_rc2));
705708
/// assert!(stable_req.matches(v_stable));
706-
///
709+
///
707710
/// // All three versions match the requirement that explicitly defines the prerelease segment
708711
/// let prerelease_req = SemanticVersionReq::parse("^1.2.3-rc.1").unwrap();
709712
/// assert!(prerelease_req.matches(v_stable));
710713
/// assert!(prerelease_req.matches(v_rc1));
711714
/// assert!(prerelease_req.matches(v_rc2));
712-
///
715+
///
713716
/// ```
714717
pub fn matches(&self, version: &SemanticVersion) -> bool {
715718
self.0.matches(version.as_ref())

0 commit comments

Comments
 (0)