Skip to content

Commit efbb5e1

Browse files
authored
chore: update to Rust 1.85.0 (#10024)
### 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. -->
1 parent 4d852f0 commit efbb5e1

File tree

12 files changed

+11
-15
lines changed

12 files changed

+11
-15
lines changed

crates/turborepo-api-client/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(async_closure)]
21
#![feature(error_generic_member_access)]
32
#![feature(assert_matches)]
43
#![deny(clippy::all)]

crates/turborepo-auth/src/auth/sso.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ pub async fn sso_login<T: Client + TokenClient + CacheClient>(
7878
api_client,
7979
sso_team,
8080
Some(valid_token_callback(
81-
"Existing Vercel token for {sso_team} found!",
81+
&format!("Existing Vercel token for {sso_team} found!"),
8282
color_config,
8383
)),
8484
)

crates/turborepo-auth/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,7 @@ fn is_token_active(metadata: &ResponseTokenMetadata, current_time: u128) -> bool
296296
// Not all scopes have an expiration date, so we need to check if all of them
297297
// are expired. If there isn't an expiration date, we assume they are infinite
298298
// and therefore cannot be expired.
299-
let all_scopes_active =
300-
earliest_expiration.map_or(true, |expiration| current_time < expiration);
299+
let all_scopes_active = earliest_expiration.is_none_or(|expiration| current_time < expiration);
301300

302301
all_scopes_active && (active_at <= current_time)
303302
}

crates/turborepo-globwatch/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ impl GlobWatcher {
214214
// requester. flushes should not be considered as events.
215215
for flush_id in e
216216
.paths
217-
.extract_if(|p| p.starts_with(flush_dir.as_path()))
217+
.extract_if(.., |p| p.starts_with(flush_dir.as_path()))
218218
.filter_map(|p| {
219219
get_flush_id(
220220
p.strip_prefix(flush_dir.as_path())

crates/turborepo-lib/src/query/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ impl RepositoryQuery {
551551
let Ok(package) = package.as_ref() else {
552552
return true;
553553
};
554-
filter.as_ref().map_or(true, |f| f.check(&package.package))
554+
filter.as_ref().is_none_or(|f| f.check(&package.package))
555555
})
556556
.collect::<Result<Array<_>, _>>()?;
557557

crates/turborepo-lib/src/run/task_id.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ impl<'a> TaskName<'a> {
260260

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

266266
pub fn into_owned(self) -> TaskName<'static> {

crates/turborepo-lib/src/task_graph/visitor/command.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl<'a> CommandProvider for PackageGraphCommandProvider<'a> {
105105
.package_json
106106
.scripts
107107
.get(task_id.task())
108-
.map_or(true, |script| script.is_empty())
108+
.is_none_or(|script| script.is_empty())
109109
{
110110
return Ok(None);
111111
}

crates/turborepo-lib/src/turbo_json/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ impl TryFrom<RawTaskDefinition> for TaskDefinition {
348348
fn try_from(raw_task: RawTaskDefinition) -> Result<Self, Error> {
349349
let outputs = raw_task.outputs.unwrap_or_default().try_into()?;
350350

351-
let cache = raw_task.cache.map_or(true, |c| c.into_inner());
351+
let cache = raw_task.cache.is_none_or(|c| c.into_inner());
352352
let interactive = raw_task
353353
.interactive
354354
.as_ref()

crates/turborepo-lockfiles/src/berry/mod.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,7 @@ impl Lockfile for BerryLockfile {
440440
.locator_for_workspace_path(workspace_path)
441441
.ok_or_else(|| crate::Error::MissingWorkspace(workspace_path.to_string()))?;
442442

443-
let dependency = self
444-
.resolve_dependency(workspace_locator, name, version)
445-
.map_err(Error::from)?;
443+
let dependency = self.resolve_dependency(workspace_locator, name, version)?;
446444

447445
let Some(locator) = self.resolutions.get(&dependency) else {
448446
return Ok(None);

crates/turborepo-repository/src/package_graph/dep_splitter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ impl<'a> DependencyVersion<'a> {
191191
constraint
192192
.ok()
193193
.zip(version.ok())
194-
.map_or(true, |(constraint, version)| constraint.satisfies(&version))
194+
.is_none_or(|(constraint, version)| constraint.satisfies(&version))
195195
}
196196
}
197197
}

packages/turbo-repository/scripts/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ script_provided_flags="\
1313
for flag in $user_provided_flags; do
1414
if [[ $flag == --target=* ]]; then
1515
target=${flag#*=}
16-
rustup toolchain install nightly-2024-11-22 --target "$target"
16+
rustup toolchain install nightly-2025-01-03 --target "$target"
1717

1818
# For we need to cross-compile some targets with Zig
1919
# Fortunately, napi comes with a `--zig` flag

rust-toolchain.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[toolchain]
22
# Needs to be copied to `packages/turbo-repository/scripts/build.sh`
3-
channel = "nightly-2024-11-22"
3+
channel = "nightly-2025-01-03"
44
components = ["rustfmt", "clippy"]
55
profile = "minimal"

0 commit comments

Comments
 (0)