Skip to content

Commit 01837f5

Browse files
committed
chore: Upgrade to Rust 1.84.0
1 parent f577739 commit 01837f5

File tree

27 files changed

+44
-41
lines changed

27 files changed

+44
-41
lines changed

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ members = [
1414
turborepo-libraries = ["path:crates/turborepo-*"]
1515
turborepo = ["path:crates/turborepo*"]
1616

17+
[workspace.lints.rust]
18+
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(debug_assert)'] }
19+
1720
[workspace.lints.clippy]
1821
too_many_arguments = "allow"
1922

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl std::fmt::Debug for APIAuth {
137137
pub fn is_linked(api_auth: &Option<APIAuth>) -> bool {
138138
api_auth
139139
.as_ref()
140-
.map_or(false, |api_auth| api_auth.is_linked())
140+
.is_some_and(|api_auth| api_auth.is_linked())
141141
}
142142

143143
impl Client for APIClient {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn make_token_name() -> Result<String, Error> {
2424
/// Perform an SSO login flow. If an existing token is present, and the token
2525
/// has access to the provided `sso_team`, we do not overwrite it and instead
2626
/// log that we found an existing token.
27-
pub async fn sso_login<'a, T: Client + TokenClient + CacheClient>(
27+
pub async fn sso_login<T: Client + TokenClient + CacheClient>(
2828
options: &LoginOptions<'_, T>,
2929
) -> Result<Token, Error> {
3030
let LoginOptions {

crates/turborepo-auth/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ impl Token {
176176
/// Checks if the token has access to the cache. This is a separate check
177177
/// from `is_active` because it's possible for a token to be active but not
178178
/// have access to the cache.
179-
pub async fn has_cache_access<'a, T: CacheClient>(
179+
pub async fn has_cache_access<T: CacheClient>(
180180
&self,
181181
client: &T,
182-
team_info: Option<TeamInfo<'a>>,
182+
team_info: Option<TeamInfo<'_>>,
183183
) -> Result<bool, Error> {
184184
let (team_id, team_slug) = match team_info {
185185
Some(TeamInfo { id, slug }) => (Some(id), Some(slug)),

crates/turborepo-cache/src/http.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl HTTPCache {
4444
let signer_verifier = if opts
4545
.remote_cache_opts
4646
.as_ref()
47-
.map_or(false, |remote_cache_opts| remote_cache_opts.signature)
47+
.is_some_and(|remote_cache_opts| remote_cache_opts.signature)
4848
{
4949
Some(ArtifactSignatureAuthenticator {
5050
team_id: api_auth

crates/turborepo-ci/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl Vendor {
9292
}
9393

9494
pub fn is(name: &str) -> bool {
95-
Self::infer().map_or(false, |v| v.name == name)
95+
Self::infer().is_some_and(|v| v.name == name)
9696
}
9797

9898
pub fn get_constant() -> Option<&'static str> {

crates/turborepo-lib/src/boundaries.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,31 +322,31 @@ impl Run {
322322
package_name: &PackageNode,
323323
) -> bool {
324324
internal_dependencies.contains(&package_name)
325-
|| unresolved_external_dependencies.map_or(false, |external_dependencies| {
325+
|| unresolved_external_dependencies.is_some_and(|external_dependencies| {
326326
external_dependencies.contains_key(package_name.as_package_name().as_str())
327327
})
328328
|| package_json
329329
.dependencies
330330
.as_ref()
331-
.map_or(false, |dependencies| {
331+
.is_some_and(|dependencies| {
332332
dependencies.contains_key(package_name.as_package_name().as_str())
333333
})
334334
|| package_json
335335
.dev_dependencies
336336
.as_ref()
337-
.map_or(false, |dev_dependencies| {
337+
.is_some_and(|dev_dependencies| {
338338
dev_dependencies.contains_key(package_name.as_package_name().as_str())
339339
})
340340
|| package_json
341341
.peer_dependencies
342342
.as_ref()
343-
.map_or(false, |peer_dependencies| {
343+
.is_some_and(|peer_dependencies| {
344344
peer_dependencies.contains_key(package_name.as_package_name().as_str())
345345
})
346346
|| package_json
347347
.optional_dependencies
348348
.as_ref()
349-
.map_or(false, |optional_dependencies| {
349+
.is_some_and(|optional_dependencies| {
350350
optional_dependencies.contains_key(package_name.as_package_name().as_str())
351351
})
352352
}

crates/turborepo-lib/src/commands/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ fn add_turbo_to_gitignore(base: &CommandBase) -> Result<(), io::Error> {
543543
} else {
544544
let gitignore = File::open(&gitignore_path)?;
545545
let mut lines = io::BufReader::new(gitignore).lines();
546-
let has_turbo = lines.any(|line| line.map_or(false, |line| line.trim() == ".turbo"));
546+
let has_turbo = lines.any(|line| line.is_ok_and(|line| line.trim() == ".turbo"));
547547
if !has_turbo {
548548
let mut gitignore = OpenOptions::new()
549549
.read(true)

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl Engine<Building> {
116116
let has_location = self
117117
.task_locations
118118
.get(&task_id)
119-
.map_or(false, |existing| existing.range.is_some());
119+
.is_some_and(|existing| existing.range.is_some());
120120

121121
if !has_location {
122122
self.task_locations.insert(task_id, location);
@@ -196,7 +196,7 @@ impl Engine<Built> {
196196
.any(|idx| {
197197
node_distances
198198
.get(&(**idx, node_idx))
199-
.map_or(false, |dist| *dist != i32::MAX)
199+
.is_some_and(|dist| *dist != i32::MAX)
200200
})
201201
.then_some(node.clone())
202202
},
@@ -490,12 +490,12 @@ impl Engine<Built> {
490490
.scripts
491491
.get(task_id.task())
492492
// handle legacy behaviour from go where an empty string may appear
493-
.map_or(false, |script| !script.is_empty());
493+
.is_some_and(|script| !script.is_empty());
494494

495495
let task_is_persistent = self
496496
.task_definitions
497497
.get(task_id)
498-
.map_or(false, |task_def| task_def.persistent);
498+
.is_some_and(|task_def| task_def.persistent);
499499

500500
Ok(task_is_persistent && package_has_task)
501501
})

crates/turborepo-lib/src/framework.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ impl Matcher {
6161
Strategy::All => self
6262
.dependencies
6363
.iter()
64-
.all(|dep| deps.map_or(false, |deps| deps.contains_key(dep))),
64+
.all(|dep| deps.is_some_and(|deps| deps.contains_key(dep))),
6565
Strategy::Some => self
6666
.dependencies
6767
.iter()
68-
.any(|dep| deps.map_or(false, |deps| deps.contains_key(dep))),
68+
.any(|dep| deps.is_some_and(|deps| deps.contains_key(dep))),
6969
}
7070
}
7171
}

crates/turborepo-lib/src/gitignore.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const TURBO_GITIGNORE_ENTRY: &str = ".turbo";
1111
const GITIGNORE_FILE: &str = ".gitignore";
1212

1313
fn has_turbo_gitignore_entry(mut lines: io::Lines<io::BufReader<File>>) -> bool {
14-
lines.any(|line| line.map_or(false, |line| line.trim() == TURBO_GITIGNORE_ENTRY))
14+
lines.any(|line| line.is_ok_and(|line| line.trim() == TURBO_GITIGNORE_ENTRY))
1515
}
1616

1717
fn get_ignore_string() -> String {

crates/turborepo-lib/src/package_changes_watcher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ impl Subscriber {
380380
let has_root_tasks = repo_state
381381
.root_turbo_json
382382
.as_ref()
383-
.map_or(false, |turbo| turbo.has_root_tasks());
383+
.is_some_and(|turbo| turbo.has_root_tasks());
384384
if !has_root_tasks {
385385
filtered_pkgs.remove(&root_pkg);
386386
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ impl RepositoryQuery {
602602
.pkg_dep_graph()
603603
.packages()
604604
.map(|(name, _)| Package::new(self.run.clone(), name.clone()))
605-
.filter(|pkg| pkg.as_ref().map_or(false, |pkg| filter.check(pkg)))
605+
.filter(|pkg| pkg.as_ref().is_ok_and(|pkg| filter.check(pkg)))
606606
.collect::<Result<Array<_>, _>>()?;
607607
packages.sort_by(|a, b| a.get_name().cmp(b.get_name()));
608608

crates/turborepo-lib/src/rewrite_json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ fn find_all_paths<'a>(
280280
let should_rewrite = if match_case_sensitive {
281281
target_path[0] == current_property_name
282282
} else {
283-
target_path[0].to_ascii_lowercase() == current_property_name.to_ascii_lowercase()
283+
target_path[0].eq_ignore_ascii_case(current_property_name)
284284
};
285285

286286
if should_rewrite {

crates/turborepo-lib/src/run/summary/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ impl<'a> RunSummary<'a> {
787787
task.shared
788788
.execution
789789
.as_ref()
790-
.map_or(false, |e| e.is_failure())
790+
.is_some_and(|e| e.is_failure())
791791
})
792792
.collect()
793793
}

crates/turborepo-lib/src/run/summary/spaces.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl SpacesClient {
146146
) -> Option<Self> {
147147
// If space_id is empty, we don't build a client
148148
let space_id = space_id?;
149-
let is_linked = api_auth.as_ref().map_or(false, |auth| auth.is_linked());
149+
let is_linked = api_auth.as_ref().is_some_and(|auth| auth.is_linked());
150150
if !is_linked {
151151
// TODO: Add back spaces warning with new UI
152152
return None;
@@ -328,13 +328,13 @@ fn trim_logs(logs: &[u8], limit: usize) -> String {
328328
// Go JSON encoding automatically did a lossy conversion for us when
329329
// encoding Golang strings into JSON.
330330
let lossy_logs = String::from_utf8_lossy(logs);
331-
if lossy_logs.as_bytes().len() <= limit {
331+
if lossy_logs.len() <= limit {
332332
lossy_logs.into_owned()
333333
} else {
334334
// We try to trim down the logs so that it is valid utf8
335335
// We attempt to parse it at every byte starting from the limit until we get a
336336
// valid utf8 which means we aren't cutting in the middle of a cluster.
337-
for start_index in (lossy_logs.as_bytes().len() - limit)..lossy_logs.as_bytes().len() {
337+
for start_index in (lossy_logs.len() - limit)..lossy_logs.len() {
338338
let log_bytes = &lossy_logs.as_bytes()[start_index..];
339339
if let Ok(log_str) = std::str::from_utf8(log_bytes) {
340340
return log_str.to_string();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl<'a> CommandProvider for PackageGraphCommandProvider<'a> {
133133
// task via an env var
134134
if self
135135
.mfe_configs
136-
.map_or(false, |mfe_configs| mfe_configs.task_has_mfe_proxy(task_id))
136+
.is_some_and(|mfe_configs| mfe_configs.task_has_mfe_proxy(task_id))
137137
{
138138
cmd.env("TURBO_TASK_HAS_MFE_PROXY", "true");
139139
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ impl RawTaskDefinition {
263263
pub fn merge(&mut self, other: RawTaskDefinition) {
264264
set_field!(self, other, outputs);
265265

266-
let other_has_range = other.cache.as_ref().map_or(false, |c| c.range.is_some());
267-
let self_does_not_have_range = self.cache.as_ref().map_or(false, |c| c.range.is_none());
266+
let other_has_range = other.cache.as_ref().is_some_and(|c| c.range.is_some());
267+
let self_does_not_have_range = self.cache.as_ref().is_some_and(|c| c.range.is_none());
268268

269269
if other.cache.is_some()
270270
// If other has range info and we're missing it, carry it over

crates/turborepo-lockfiles/src/yarn1/ser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl fmt::Display for Yarn1Lockfile {
4949
let mut added_keys: HashSet<&str> = HashSet::with_capacity(self.inner.len());
5050
for (key, entry) in self.inner.iter() {
5151
let seen_key = seen_keys.get(key.as_str());
52-
let seen_pattern = seen_key.map_or(false, |key| added_keys.contains(key.as_str()));
52+
let seen_pattern = seen_key.is_some_and(|key| added_keys.contains(key.as_str()));
5353
if seen_pattern {
5454
continue;
5555
}
@@ -243,7 +243,7 @@ fn should_wrap_key(s: &str) -> bool {
243243
s.starts_with("true") ||
244244
s.starts_with("false") ||
245245
// Wrap if it doesn't start with a-zA-Z
246-
s.chars().next().map_or(false, |c| !c.is_ascii_alphabetic()) ||
246+
s.chars().next().is_some_and(|c| !c.is_ascii_alphabetic()) ||
247247
// Wrap if it contains any unwanted chars
248248
s.chars().any(|c| matches!(
249249
c,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl<'a, P> PackageGraphBuilder<'a, P> {
119119
}
120120
}
121121

122-
impl<'a, T> PackageGraphBuilder<'a, T>
122+
impl<T> PackageGraphBuilder<'_, T>
123123
where
124124
T: PackageDiscoveryBuilder,
125125
T::Output: Send + Sync,
@@ -469,7 +469,7 @@ impl<'a, T: PackageDiscovery> BuildState<'a, ResolvedWorkspaces, T> {
469469
}
470470
}
471471

472-
impl<'a, T: PackageDiscovery> BuildState<'a, ResolvedLockfile, T> {
472+
impl<T: PackageDiscovery> BuildState<'_, ResolvedLockfile, T> {
473473
fn all_external_dependencies(&self) -> Result<HashMap<String, HashMap<String, String>>, Error> {
474474
self.workspaces
475475
.values()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl<'a> DependencyVersion<'a> {
143143
// behavior before this additional logic was added.
144144

145145
// TODO: extend this to support the `enableTransparentWorkspaces` yarn option
146-
self.protocol.map_or(false, |p| p != "npm")
146+
self.protocol.is_some_and(|p| p != "npm")
147147
}
148148

149149
fn matches_workspace_package(

crates/turborepo-ui/src/tui/app.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,8 +681,8 @@ async fn run_app_inner<B: Backend + std::io::Write>(
681681

682682
/// Blocking poll for events, will only return None if app handle has been
683683
/// dropped
684-
async fn poll<'a>(
685-
input_options: InputOptions<'a>,
684+
async fn poll(
685+
input_options: InputOptions<'_>,
686686
receiver: &mut AppReceiver,
687687
crossterm_rx: &mut mpsc::Receiver<crossterm::event::Event>,
688688
) -> Option<Event> {

crates/turborepo-ui/src/tui/debouncer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl<T> Debouncer<T> {
2323
pub fn query(&mut self) -> Option<T> {
2424
if self
2525
.start
26-
.map_or(false, |start| start.elapsed() >= self.duration)
26+
.is_some_and(|start| start.elapsed() >= self.duration)
2727
{
2828
self.start = None;
2929
self.value.take()

crates/turborepo-ui/src/tui/term_output.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ impl<W> TerminalOutput<W> {
129129
self.parser
130130
.screen()
131131
.selected_text()
132-
.map_or(false, |s| !s.is_empty())
132+
.is_some_and(|s| !s.is_empty())
133133
}
134134

135135
pub fn handle_mouse(&mut self, event: crossterm::event::MouseEvent) -> Result<(), Error> {

crates/turborepo-ui/src/wui/query.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct CurrentRun<'a> {
1717
}
1818

1919
#[Object]
20-
impl<'a> CurrentRun<'a> {
20+
impl CurrentRun<'_> {
2121
async fn tasks(&self) -> Vec<RunTask> {
2222
self.state
2323
.lock()

crates/turborepo-vt100/src/screen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ impl Screen {
698698
pub fn row_wrapped(&self, row: u16) -> bool {
699699
self.grid()
700700
.visible_row(row)
701-
.map_or(false, crate::row::Row::wrapped)
701+
.is_some_and(crate::row::Row::wrapped)
702702
}
703703

704704
/// Returns the terminal's window title.

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[toolchain]
2-
channel = "nightly-2024-10-11"
2+
channel = "nightly-2024-11-22"
33
components = ["rustfmt", "clippy"]
44
profile = "minimal"

0 commit comments

Comments
 (0)