Skip to content

Commit

Permalink
chore: update to Rust 1.85.0 (#10024)
Browse files Browse the repository at this point in the history
### Description

- Vec::extract_if signature changed:
rust-lang/rust#133265
- crates/turborepo-auth/src/auth/sso.rs: allow 'foramatting_args' in
literal string (should it be put in `format!` instead?)
- async_closure is now stable
- further `map_or` simplification
<!--
  ✍️ Write a short summary of your work.
  If necessary, include relevant screenshots.
-->

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->
  • Loading branch information
ognevny authored Mar 5, 2025
1 parent 4d852f0 commit efbb5e1
Show file tree
Hide file tree
Showing 12 changed files with 11 additions and 15 deletions.
1 change: 0 additions & 1 deletion crates/turborepo-api-client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(async_closure)]
#![feature(error_generic_member_access)]
#![feature(assert_matches)]
#![deny(clippy::all)]
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-auth/src/auth/sso.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub async fn sso_login<T: Client + TokenClient + CacheClient>(
api_client,
sso_team,
Some(valid_token_callback(
"Existing Vercel token for {sso_team} found!",
&format!("Existing Vercel token for {sso_team} found!"),
color_config,
)),
)
Expand Down
3 changes: 1 addition & 2 deletions crates/turborepo-auth/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,7 @@ fn is_token_active(metadata: &ResponseTokenMetadata, current_time: u128) -> bool
// Not all scopes have an expiration date, so we need to check if all of them
// are expired. If there isn't an expiration date, we assume they are infinite
// and therefore cannot be expired.
let all_scopes_active =
earliest_expiration.map_or(true, |expiration| current_time < expiration);
let all_scopes_active = earliest_expiration.is_none_or(|expiration| current_time < expiration);

all_scopes_active && (active_at <= current_time)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-globwatch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ impl GlobWatcher {
// requester. flushes should not be considered as events.
for flush_id in e
.paths
.extract_if(|p| p.starts_with(flush_dir.as_path()))
.extract_if(.., |p| p.starts_with(flush_dir.as_path()))
.filter_map(|p| {
get_flush_id(
p.strip_prefix(flush_dir.as_path())
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-lib/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ impl RepositoryQuery {
let Ok(package) = package.as_ref() else {
return true;
};
filter.as_ref().map_or(true, |f| f.check(&package.package))
filter.as_ref().is_none_or(|f| f.check(&package.package))
})
.collect::<Result<Array<_>, _>>()?;

Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-lib/src/run/task_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ impl<'a> TaskName<'a> {

pub fn in_workspace(&self, workspace: &str) -> bool {
self.task_id()
.map_or(true, |task_id| task_id.package() == workspace)
.is_none_or(|task_id| task_id.package() == workspace)
}

pub fn into_owned(self) -> TaskName<'static> {
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-lib/src/task_graph/visitor/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl<'a> CommandProvider for PackageGraphCommandProvider<'a> {
.package_json
.scripts
.get(task_id.task())
.map_or(true, |script| script.is_empty())
.is_none_or(|script| script.is_empty())
{
return Ok(None);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-lib/src/turbo_json/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ impl TryFrom<RawTaskDefinition> for TaskDefinition {
fn try_from(raw_task: RawTaskDefinition) -> Result<Self, Error> {
let outputs = raw_task.outputs.unwrap_or_default().try_into()?;

let cache = raw_task.cache.map_or(true, |c| c.into_inner());
let cache = raw_task.cache.is_none_or(|c| c.into_inner());
let interactive = raw_task
.interactive
.as_ref()
Expand Down
4 changes: 1 addition & 3 deletions crates/turborepo-lockfiles/src/berry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,7 @@ impl Lockfile for BerryLockfile {
.locator_for_workspace_path(workspace_path)
.ok_or_else(|| crate::Error::MissingWorkspace(workspace_path.to_string()))?;

let dependency = self
.resolve_dependency(workspace_locator, name, version)
.map_err(Error::from)?;
let dependency = self.resolve_dependency(workspace_locator, name, version)?;

let Some(locator) = self.resolutions.get(&dependency) else {
return Ok(None);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ impl<'a> DependencyVersion<'a> {
constraint
.ok()
.zip(version.ok())
.map_or(true, |(constraint, version)| constraint.satisfies(&version))
.is_none_or(|(constraint, version)| constraint.satisfies(&version))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/turbo-repository/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ script_provided_flags="\
for flag in $user_provided_flags; do
if [[ $flag == --target=* ]]; then
target=${flag#*=}
rustup toolchain install nightly-2024-11-22 --target "$target"
rustup toolchain install nightly-2025-01-03 --target "$target"

# For we need to cross-compile some targets with Zig
# Fortunately, napi comes with a `--zig` flag
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
# Needs to be copied to `packages/turbo-repository/scripts/build.sh`
channel = "nightly-2024-11-22"
channel = "nightly-2025-01-03"
components = ["rustfmt", "clippy"]
profile = "minimal"

0 comments on commit efbb5e1

Please sign in to comment.