Skip to content

Commit 8113d43

Browse files
authored
chore: update to Rust 1.89.0 (#10749)
### Description <!-- ✍️ Write a short summary of your work. If necessary, include relevant screenshots. --> - fix mismatched_lifetime_syntaxes lints - let chains are now stable in edition 2024, so use them - change workspace logic so "2024" edition is now applied for all package with `workspace = true` ### Testing Instructions CI <!-- Give a quick description of steps to test your changes. -->
1 parent f9a61db commit 8113d43

File tree

86 files changed

+334
-353
lines changed

Some content is hidden

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

86 files changed

+334
-353
lines changed

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ members = [
88
"packages/turbo-repository/rust",
99
]
1010

11+
[workspace.package]
12+
edition = "2024"
13+
1114
[workspace.metadata.groups]
1215
# Only the libraries, does not include the turborepo binary.
1316
# That way we don't have to build the Go code

crates/coverage/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "coverage"
33
version = "0.1.0"
4-
edition = "2021"
4+
edition = { workspace = true }
55
license = "MIT"
66

77
[[bin]]

crates/coverage/src/main.rs

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ struct Args {
1616
/// Find the llvm-profdata binary using rustup
1717
fn find_llvm_profdata() -> Result<std::path::PathBuf> {
1818
// First try to find it in PATH
19-
if let Ok(output) = Command::new("which").arg("llvm-profdata").output() {
20-
if output.status.success() {
21-
let path = String::from_utf8_lossy(&output.stdout).trim().to_string();
22-
if !path.is_empty() {
23-
return Ok(std::path::PathBuf::from(path));
24-
}
19+
if let Ok(output) = Command::new("which").arg("llvm-profdata").output()
20+
&& output.status.success()
21+
{
22+
let path = String::from_utf8_lossy(&output.stdout).trim().to_string();
23+
if !path.is_empty() {
24+
return Ok(std::path::PathBuf::from(path));
2525
}
2626
}
2727

@@ -108,12 +108,12 @@ fn find_llvm_profdata() -> Result<std::path::PathBuf> {
108108
/// Find the llvm-cov binary using the same approach as llvm-profdata
109109
fn find_llvm_cov() -> Result<std::path::PathBuf> {
110110
// First try to find it in PATH
111-
if let Ok(output) = Command::new("which").arg("llvm-cov").output() {
112-
if output.status.success() {
113-
let path = String::from_utf8_lossy(&output.stdout).trim().to_string();
114-
if !path.is_empty() {
115-
return Ok(std::path::PathBuf::from(path));
116-
}
111+
if let Ok(output) = Command::new("which").arg("llvm-cov").output()
112+
&& output.status.success()
113+
{
114+
let path = String::from_utf8_lossy(&output.stdout).trim().to_string();
115+
if !path.is_empty() {
116+
return Ok(std::path::PathBuf::from(path));
117117
}
118118
}
119119

@@ -228,22 +228,18 @@ fn main() -> Result<()> {
228228

229229
let mut object_args = Vec::new();
230230
for line in binaries_json.lines() {
231-
if let Ok(json) = serde_json::from_str::<serde_json::Value>(line) {
232-
if let Some(profile) = json.get("profile") {
233-
if let Some(test) = profile.get("test") {
234-
if test.as_bool() == Some(true) {
235-
if let Some(filenames) = json.get("filenames") {
236-
if let Some(filenames_array) = filenames.as_array() {
237-
for filename in filenames_array {
238-
if let Some(path) = filename.as_str() {
239-
if !path.contains("dSYM") {
240-
object_args.push(format!("--object={path}"));
241-
}
242-
}
243-
}
244-
}
245-
}
246-
}
231+
if let Ok(json) = serde_json::from_str::<serde_json::Value>(line)
232+
&& let Some(profile) = json.get("profile")
233+
&& let Some(test) = profile.get("test")
234+
&& test.as_bool() == Some(true)
235+
&& let Some(filenames) = json.get("filenames")
236+
&& let Some(filenames_array) = filenames.as_array()
237+
{
238+
for filename in filenames_array {
239+
if let Some(path) = filename.as_str()
240+
&& !path.contains("dSYM")
241+
{
242+
object_args.push(format!("--object={path}"));
247243
}
248244
}
249245
}

crates/turbo-trace/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "turbo-trace"
33
version = "0.1.0"
4-
edition = "2024"
4+
edition = { workspace = true }
55
license = "MIT"
66

77
[dependencies]

crates/turbo-trace/src/import_finder.rs

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -84,27 +84,16 @@ impl Visit for ImportFinder {
8484
fn visit_stmt(&mut self, stmt: &Stmt) {
8585
if let Stmt::Decl(Decl::Var(var_decl)) = stmt {
8686
for decl in &var_decl.decls {
87-
if let Some(init) = &decl.init {
88-
if let swc_ecma_ast::Expr::Call(call_expr) = &**init {
89-
if let swc_ecma_ast::Callee::Expr(expr) = &call_expr.callee {
90-
if let swc_ecma_ast::Expr::Ident(ident) = &**expr {
91-
if ident.sym == *"require" {
92-
if let Some(arg) = call_expr.args.first() {
93-
if let swc_ecma_ast::Expr::Lit(swc_ecma_ast::Lit::Str(
94-
lit_str,
95-
)) = &*arg.expr
96-
{
97-
self.imports.push((
98-
lit_str.value.to_string(),
99-
expr.span(),
100-
ImportType::Value,
101-
));
102-
}
103-
}
104-
}
105-
}
106-
}
107-
}
87+
if let Some(init) = &decl.init
88+
&& let swc_ecma_ast::Expr::Call(call_expr) = &**init
89+
&& let swc_ecma_ast::Callee::Expr(expr) = &call_expr.callee
90+
&& let swc_ecma_ast::Expr::Ident(ident) = &**expr
91+
&& ident.sym == *"require"
92+
&& let Some(arg) = call_expr.args.first()
93+
&& let swc_ecma_ast::Expr::Lit(swc_ecma_ast::Lit::Str(lit_str)) = &*arg.expr
94+
{
95+
self.imports
96+
.push((lit_str.value.to_string(), expr.span(), ImportType::Value));
10897
}
10998
}
11099
}

crates/turbo-trace/src/tracer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,10 +387,10 @@ impl Tracer {
387387
let resolver = Self::create_resolver(self.ts_config.as_deref());
388388

389389
while let Some((file_path, file_depth)) = self.files.pop() {
390-
if let Some(max_depth) = max_depth {
391-
if file_depth > max_depth {
392-
continue;
393-
}
390+
if let Some(max_depth) = max_depth
391+
&& file_depth > max_depth
392+
{
393+
continue;
394394
}
395395
self.trace_file(&resolver, file_path, file_depth, &mut seen)
396396
.await;

crates/turborepo-analytics/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "turborepo-analytics"
33
version = "0.1.0"
4-
edition = "2024"
4+
edition = { workspace = true }
55
license = "MIT"
66

77
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

crates/turborepo-api-client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "turborepo-api-client"
33
version = "0.1.0"
4-
edition = "2024"
4+
edition = { workspace = true }
55
license = "MIT"
66

77
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@ impl Client for APIClient {
182182
Ok(response.json().await?)
183183
}
184184
fn add_ci_header(mut request_builder: RequestBuilder) -> RequestBuilder {
185-
if is_ci() {
186-
if let Some(vendor_constant) = Vendor::get_constant() {
187-
request_builder = request_builder.header("x-artifact-client-ci", vendor_constant);
188-
}
185+
if is_ci()
186+
&& let Some(vendor_constant) = Vendor::get_constant()
187+
{
188+
request_builder = request_builder.header("x-artifact-client-ci", vendor_constant);
189189
}
190190

191191
request_builder

crates/turborepo-auth/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "turborepo-auth"
33
version = "0.1.0"
4-
edition = "2024"
4+
edition = { workspace = true }
55
license = "MIT"
66

77
[lints]

0 commit comments

Comments
 (0)