Skip to content

Commit 992d293

Browse files
authored
build: Update to Rust v1.88. (#2041)
* Bump version. * Fix lints. * Update if let.
1 parent 653e908 commit 992d293

45 files changed

Lines changed: 299 additions & 305 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
- `$projectType` -> `$projectLayer` for task tokens
1414
- `enforceProjectTypeRelationships` -> `enforceLayerRelationships` in `.moon/workspace.yml`
1515

16+
#### ⚙️ Internal
17+
18+
- Updated Rust to v1.88.0.
19+
1620
## 1.38.3
1721

1822
#### 🐞 Fixes

crates/action-context/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ impl ActionContext {
121121

122122
// :task == scope:task
123123
for other_target in &self.initial_targets {
124-
if let TargetLocator::Qualified(other_target) = other_target {
125-
if other_target.is_all_task(&target.task_id) {
126-
return true;
127-
}
124+
if let TargetLocator::Qualified(other_target) = other_target
125+
&& other_target.is_all_task(&target.task_id)
126+
{
127+
return true;
128128
}
129129
}
130130

crates/action-graph/src/action_graph_builder.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ impl<'query> ActionGraphBuilder<'query> {
629629
TargetScope::Tag(tag) => {
630630
let projects = self
631631
.workspace_graph
632-
.query_projects(build_query(format!("tag={}", tag).as_str())?)?;
632+
.query_projects(build_query(format!("tag={tag}").as_str())?)?;
633633

634634
for project in projects {
635635
// Don't error if the task does not exist
@@ -977,10 +977,10 @@ impl<'query> ActionGraphBuilder<'query> {
977977
}
978978

979979
// Return early if not affected
980-
if let Some(affected) = &mut self.affected {
981-
if !affected.is_project_marked(project) {
982-
return Ok(None);
983-
}
980+
if let Some(affected) = &mut self.affected
981+
&& !affected.is_project_marked(project)
982+
{
983+
return Ok(None);
984984
}
985985

986986
// Insert the node and edges

crates/action/src/operation.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,10 @@ impl Operation {
217217
{
218218
let result = func().await;
219219

220-
if let Ok(files) = &result {
221-
if let Some(sync) = self.get_file_state_mut() {
222-
sync.changed_files.extend(files.clone());
223-
}
220+
if let Ok(files) = &result
221+
&& let Some(sync) = self.get_file_state_mut()
222+
{
223+
sync.changed_files.extend(files.clone());
224224
}
225225

226226
self.handle_track(result, |_| true).map(|_| self)

crates/actions/src/actions/install_dependencies.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -203,21 +203,21 @@ pub async fn install_dependencies(
203203
.extend(exec_plugin_command(app_context.clone(), &install, &options).await?);
204204
}
205205

206-
if !is_ci() {
207-
if let Some(mut dedupe) = output.dedupe_command {
208-
debug!(
209-
root = node.root.as_str(),
210-
toolchain_id = node.toolchain_id.as_str(),
211-
"Deduping {} dependencies",
212-
toolchain.metadata.name
213-
);
214-
215-
dedupe.cache = None; // Disable
216-
dedupe.command.stream = !hide_output;
217-
action
218-
.operations
219-
.extend(exec_plugin_command(app_context, &dedupe, &options).await?);
220-
}
206+
if !is_ci()
207+
&& let Some(mut dedupe) = output.dedupe_command
208+
{
209+
debug!(
210+
root = node.root.as_str(),
211+
toolchain_id = node.toolchain_id.as_str(),
212+
"Deduping {} dependencies",
213+
toolchain.metadata.name
214+
);
215+
216+
dedupe.cache = None; // Disable
217+
dedupe.command.stream = !hide_output;
218+
action
219+
.operations
220+
.extend(exec_plugin_command(app_context, &dedupe, &options).await?);
221221
}
222222

223223
finalize_action_operations(action, &toolchain, setup_op, output.operations, vec![])?;

crates/actions/src/actions/sync_project.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,12 @@ pub async fn sync_project(
7272

7373
// Loop through legacy platforms
7474
for toolchain_id in project.get_enabled_toolchains() {
75-
if let Ok(platform) = PlatformManager::read().get_by_toolchain(toolchain_id) {
76-
if platform
75+
if let Ok(platform) = PlatformManager::read().get_by_toolchain(toolchain_id)
76+
&& platform
7777
.sync_project(&action_context, &project, &dependencies)
7878
.await?
79-
{
80-
mutated_files = true;
81-
}
79+
{
80+
mutated_files = true;
8281
}
8382
}
8483

crates/actions/src/utils.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ pub fn should_skip_action(key: &str) -> Option<String> {
4242
}
4343

4444
pub fn should_skip_action_matching<V: AsRef<str>>(key: &str, pattern: V) -> Option<String> {
45-
if let Some(value) = GlobalEnvBag::instance().get(key) {
46-
if matches_pattern(&value, pattern.as_ref()) {
47-
return Some(value);
48-
}
45+
if let Some(value) = GlobalEnvBag::instance().get(key)
46+
&& matches_pattern(&value, pattern.as_ref())
47+
{
48+
return Some(value);
4949
}
5050

5151
None

crates/affected/src/affected_tracker.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,10 @@ impl AffectedTracker {
350350
let bag = GlobalEnvBag::instance();
351351

352352
for var_name in &task.input_env {
353-
if let Some(var) = bag.get(var_name) {
354-
if !var.is_empty() {
355-
return Ok(Some(AffectedBy::EnvironmentVariable(var_name.to_owned())));
356-
}
353+
if let Some(var) = bag.get(var_name)
354+
&& !var.is_empty()
355+
{
356+
return Ok(Some(AffectedBy::EnvironmentVariable(var_name.to_owned())));
357357
}
358358
}
359359
}

crates/app/src/commands/docker/prune.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,12 @@ pub async fn prune_bun(
206206
let mut package_names = vec![];
207207

208208
for project_id in &manifest.focused_projects {
209-
if let Some(source) = project_graph.sources().get(project_id) {
210-
if let Some(package_json) =
209+
if let Some(source) = project_graph.sources().get(project_id)
210+
&& let Some(package_json) =
211211
PackageJsonCache::read(source.to_path(&session.workspace_root))?
212-
{
213-
if let Some(package_name) = package_json.data.name {
214-
package_names.push(package_name);
215-
}
216-
}
212+
&& let Some(package_name) = package_json.data.name
213+
{
214+
package_names.push(package_name);
217215
}
218216
}
219217

@@ -272,14 +270,12 @@ pub async fn prune_node(
272270
let mut package_names = vec![];
273271

274272
for project_id in &manifest.focused_projects {
275-
if let Some(source) = project_graph.sources().get(project_id) {
276-
if let Some(package_json) =
273+
if let Some(source) = project_graph.sources().get(project_id)
274+
&& let Some(package_json) =
277275
PackageJsonCache::read(source.to_path(&session.workspace_root))?
278-
{
279-
if let Some(package_name) = package_json.data.name {
280-
package_names.push(package_name);
281-
}
282-
}
276+
&& let Some(package_name) = package_json.data.name
277+
{
278+
package_names.push(package_name);
283279
}
284280
}
285281

crates/app/src/commands/generate.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,12 @@ pub fn parse_args_into_variables(
202202
TemplateVariable::Boolean(_) => {
203203
// Booleans always have a value when matched, so only extract
204204
// the value when it was actually passed on the command line
205-
if let Some(ValueSource::CommandLine) = matches.value_source(arg_name) {
206-
if let Some(value) = matches.get_one::<bool>(arg_name) {
207-
debug!(name, value, "Setting boolean variable");
205+
if let Some(ValueSource::CommandLine) = matches.value_source(arg_name)
206+
&& let Some(value) = matches.get_one::<bool>(arg_name)
207+
{
208+
debug!(name, value, "Setting boolean variable");
208209

209-
vars.insert(name, value);
210-
}
210+
vars.insert(name, value);
211211
}
212212
}
213213
TemplateVariable::Enum(inner) => {

0 commit comments

Comments
 (0)