Skip to content

Commit

Permalink
deps: Upgrade to Rust v1.67. (#618)
Browse files Browse the repository at this point in the history
* Bump version.

* First pass.

* Fix format.
  • Loading branch information
milesj committed Feb 28, 2023
1 parent 60e0b82 commit fd50427
Show file tree
Hide file tree
Showing 63 changed files with 151 additions and 163 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
# ref: ${{ github.event.pull_request.head.sha }}
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.66.0
toolchain: 1.67.0
profile: minimal
- uses: Swatinem/rust-cache@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/moon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
cache: yarn
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.66.0
toolchain: 1.67.0
profile: minimal
- uses: Swatinem/rust-cache@v2
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: actions-rs/toolchain@v1
name: Setup toolchain
with:
toolchain: 1.66.0
toolchain: 1.67.0
profile: minimal
components: rustfmt
- uses: Swatinem/rust-cache@v2
Expand All @@ -48,7 +48,7 @@ jobs:
- uses: actions-rs/toolchain@v1
name: Setup toolchain
with:
toolchain: 1.66.0
toolchain: 1.67.0
profile: minimal
components: clippy
- uses: Swatinem/rust-cache@v2
Expand All @@ -69,7 +69,7 @@ jobs:
- uses: actions-rs/toolchain@v1
name: Setup toolchain
with:
toolchain: 1.66.0
toolchain: 1.67.0
profile: minimal
components: llvm-tools-preview
- name: Cache cargo
Expand Down
6 changes: 3 additions & 3 deletions crates/cli/src/commands/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ fn distribute_targets_across_jobs(
let batched_targets;

print_header(provider, "Distributing targets across jobs");
println!("Job index: {}", job_index);
println!("Job total: {}", job_index);
println!("Batch size: {}", batch_size);
println!("Job index: {job_index}");
println!("Job total: {job_index}");
println!("Batch size: {batch_size}");
println!("Batched targets:");

if job_index == 0 {
Expand Down
5 changes: 1 addition & 4 deletions crates/cli/src/commands/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ pub async fn clean(options: CleanOptions) -> Result<(), AnyError> {
workspace.cache.clean_stale_cache(&options.cache_lifetime)?;

done(
format!(
"Deleted {} files and saved {} bytes",
files_deleted, bytes_saved
),
format!("Deleted {files_deleted} files and saved {bytes_saved} bytes"),
true,
);

Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/commands/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fn parse_var_args(vars: &[String]) -> FxHashMap<String, String> {
} else {
name
};
let comment = color::muted_light(format!("(from --{})", name));
let comment = color::muted_light(format!("(from --{name})"));

log_var(name, &value, Some(&comment));

Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/commands/graph/dep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub async fn dep_graph(target_id: Option<String>, dot: bool, json: bool) -> Resu
let url = format!("http://{}", server.server_addr());
let _ = open::that(&url);

println!("Started server on {}", url);
println!("Started server on {url}");

for req in server.incoming_requests() {
respond_to_request(req, &mut tera, &graph_info, "Dependency graph".to_owned())?;
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/commands/graph/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub async fn project_graph(
let url = format!("http://{}", server.server_addr());
let _ = open::that(&url);

println!("Started server on {}", url);
println!("Started server on {url}");

for req in server.incoming_requests() {
respond_to_request(req, &mut tera, &graph_info, "Project graph".to_owned())?;
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/commands/graph/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub async fn setup_server() -> Result<(Server, Tera), AnyError> {
Ok(h) => h,
Err(..) => "127.0.0.1".to_string(),
};
let address = format!("{}:{}", host, port);
let address = format!("{host}:{port}");
let server = Server::http(address).unwrap();
let tera = Tera::default();

Expand Down
9 changes: 4 additions & 5 deletions crates/cli/src/commands/migrate/from_turborepo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub fn convert_globals(turbo: &TurboJson, tasks_config: &mut InheritedTasksConfi

if let Some(global_env) = &turbo.global_env {
for env in global_env {
tasks_config.implicit_inputs.push(format!("${}", env));
tasks_config.implicit_inputs.push(format!("${env}"));
}

modified = true;
Expand All @@ -66,8 +66,7 @@ pub fn convert_task(name: String, task: TurboTask) -> TaskConfig {
let mut inputs = vec![];

config.command = Some(TaskCommandArgs::String(format!(
"moon node run-script {}",
name
"moon node run-script {name}"
)));

if let Some(turbo_deps) = task.depends_on {
Expand All @@ -92,7 +91,7 @@ pub fn convert_task(name: String, task: TurboTask) -> TaskConfig {

if let Some(turbo_env) = task.env {
for env in turbo_env {
inputs.push(format!("${}", env));
inputs.push(format!("${env}"));
}
}

Expand All @@ -105,7 +104,7 @@ pub fn convert_task(name: String, task: TurboTask) -> TaskConfig {

for output in turbo_outputs {
if output.ends_with("/**") {
outputs.push(format!("{}/*", output));
outputs.push(format!("{output}/*"));
} else {
outputs.push(output);
}
Expand Down
5 changes: 2 additions & 3 deletions crates/cli/src/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,10 @@ pub async fn run_target(
};

println!(
"Target(s) {} not affected by touched files (using status {})",
targets_list, status_list
"Target(s) {targets_list} not affected by touched files (using status {status_list})"
);
} else {
println!("No tasks found for target(s) {}", targets_list);
println!("No tasks found for target(s) {targets_list}");
}

return Ok(());
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/commands/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub async fn sync() -> Result<(), AnyError> {
let results = pipeline.run(dep_graph, None).await?;

done(
format!("Successfully synced {} projects", project_count),
format!("Successfully synced {project_count} projects"),
true,
);

Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/queries/projects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn convert_to_regex(field: &str, value: &Option<String>) -> Result<Option<regex:
);

// case-insensitive by default
Ok(Some(regex::create_regex(&format!("(?i){}", pattern))?))
Ok(Some(regex::create_regex(&format!("(?i){pattern}"))?))
}
None => Ok(None),
}
Expand Down
6 changes: 3 additions & 3 deletions crates/cli/tests/run_node_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn depman_sandbox(depman: &str) -> Sandbox {
get_node_depman_fixture_configs(depman);

let sandbox = create_sandbox_with_config(
format!("node-{}/workspaces", depman),
format!("node-{depman}/workspaces"),
Some(&workspace_config),
Some(&toolchain_config),
Some(&tasks_config),
Expand All @@ -65,7 +65,7 @@ fn depman_non_workspaces_sandbox(depman: &str) -> Sandbox {
WorkspaceProjects::Sources(FxHashMap::from_iter([("root".to_owned(), ".".to_owned())]));

let sandbox = create_sandbox_with_config(
format!("node-{}/project", depman),
format!("node-{depman}/project"),
Some(&workspace_config),
Some(&toolchain_config),
Some(&tasks_config),
Expand Down Expand Up @@ -575,7 +575,7 @@ mod sync_depends_on {

// deps-c does not have a `package.json` on purpose
assert_snapshot!(
format!("format_{:?}", format),
format!("format_{format:?}"),
read_to_string(sandbox.path().join("depends-on/package.json")).unwrap()
);
}
Expand Down
32 changes: 16 additions & 16 deletions crates/cli/tests/run_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,14 +499,14 @@ mod outputs {
assert!(sandbox
.path()
.join(".moon/cache/hashes")
.join(format!("{}.json", hash))
.join(format!("{hash}.json"))
.exists());

// outputs
assert!(sandbox
.path()
.join(".moon/cache/outputs")
.join(format!("{}.tar.gz", hash))
.join(format!("{hash}.tar.gz"))
.exists());
}

Expand All @@ -525,14 +525,14 @@ mod outputs {
assert!(sandbox
.path()
.join(".moon/cache/hashes")
.join(format!("{}.json", hash))
.join(format!("{hash}.json"))
.exists());

// outputs
assert!(sandbox
.path()
.join(".moon/cache/outputs")
.join(format!("{}.tar.gz", hash))
.join(format!("{hash}.tar.gz"))
.exists());
}

Expand All @@ -551,14 +551,14 @@ mod outputs {
assert!(sandbox
.path()
.join(".moon/cache/hashes")
.join(format!("{}.json", hash))
.join(format!("{hash}.json"))
.exists());

// outputs
assert!(sandbox
.path()
.join(".moon/cache/outputs")
.join(format!("{}.tar.gz", hash))
.join(format!("{hash}.tar.gz"))
.exists());
}

Expand All @@ -577,14 +577,14 @@ mod outputs {
assert!(sandbox
.path()
.join(".moon/cache/hashes")
.join(format!("{}.json", hash))
.join(format!("{hash}.json"))
.exists());

// outputs
assert!(sandbox
.path()
.join(".moon/cache/outputs")
.join(format!("{}.tar.gz", hash))
.join(format!("{hash}.tar.gz"))
.exists());
}

Expand All @@ -603,14 +603,14 @@ mod outputs {
assert!(sandbox
.path()
.join(".moon/cache/hashes")
.join(format!("{}.json", hash))
.join(format!("{hash}.json"))
.exists());

// outputs
assert!(sandbox
.path()
.join(".moon/cache/outputs")
.join(format!("{}.tar.gz", hash))
.join(format!("{hash}.tar.gz"))
.exists());
}

Expand All @@ -627,7 +627,7 @@ mod outputs {
let tarball = sandbox
.path()
.join(".moon/cache/outputs")
.join(format!("{}.tar.gz", hash));
.join(format!("{hash}.tar.gz"));
let dir = sandbox.path().join(".moon/cache/outputs").join(hash);

moon_archive::untar(tarball, &dir, None).unwrap();
Expand All @@ -651,7 +651,7 @@ mod outputs {
let tarball = sandbox
.path()
.join(".moon/cache/outputs")
.join(format!("{}.tar.gz", hash));
.join(format!("{hash}.tar.gz"));
let dir = sandbox.path().join(".moon/cache/outputs").join(hash);

moon_archive::untar(tarball, &dir, None).unwrap();
Expand Down Expand Up @@ -820,7 +820,7 @@ mod outputs {

assert!(!sandbox
.path()
.join(format!(".moon/cache/outputs/{}.tar.gz", hash))
.join(format!(".moon/cache/outputs/{hash}.tar.gz"))
.exists());
}

Expand All @@ -842,7 +842,7 @@ mod outputs {

assert!(sandbox
.path()
.join(format!(".moon/cache/outputs/{}.tar.gz", hash))
.join(format!(".moon/cache/outputs/{hash}.tar.gz"))
.exists());
}

Expand All @@ -862,7 +862,7 @@ mod outputs {

assert!(sandbox
.path()
.join(format!(".moon/cache/outputs/{}.tar.gz", hash))
.join(format!(".moon/cache/outputs/{hash}.tar.gz"))
.exists());
}

Expand All @@ -882,7 +882,7 @@ mod outputs {

assert!(!sandbox
.path()
.join(format!(".moon/cache/outputs/{}.tar.gz", hash))
.join(format!(".moon/cache/outputs/{hash}.tar.gz"))
.exists());
}

Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/run_webhooks_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn sandbox(uri: String) -> Sandbox {
let (mut workspace_config, toolchain_config, tasks_config) = get_node_fixture_configs();

workspace_config.notifier = NotifierConfig {
webhook_url: Some(format!("{}/webhook", uri)),
webhook_url: Some(format!("{uri}/webhook")),
};

let sandbox = create_sandbox_with_config(
Expand Down
13 changes: 6 additions & 7 deletions crates/core/action-pipeline/src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl Pipeline {

for (b, batch) in batches.into_iter().enumerate() {
let batch_index = b + 1;
let batch_target_name = format!("{}:batch:{}", LOG_TARGET, batch_index);
let batch_target_name = format!("{LOG_TARGET}:batch:{batch_index}");
let actions_count = batch.len();
let mut action_handles = vec![];

Expand All @@ -131,7 +131,7 @@ impl Pipeline {
let runtime = tokio::runtime::Handle::current();

let mut action = Action::new(node.to_owned());
action.log_target = format!("{}:{}", batch_target_name, action_index);
action.log_target = format!("{batch_target_name}:{action_index}");

action_handles.push(pool.complete(async move {
runtime
Expand Down Expand Up @@ -310,20 +310,19 @@ impl Pipeline {
if pass_count > 0 {
if cached_count > 0 {
counts_message.push(color::success(format!(
"{} completed ({} cached)",
pass_count, cached_count
"{pass_count} completed ({cached_count} cached)"
)));
} else {
counts_message.push(color::success(format!("{} completed", pass_count)));
counts_message.push(color::success(format!("{pass_count} completed")));
}
}

if fail_count > 0 {
counts_message.push(color::failure(format!("{} failed", fail_count)));
counts_message.push(color::failure(format!("{fail_count} failed")));
}

if invalid_count > 0 {
counts_message.push(color::invalid(format!("{} invalid", invalid_count)));
counts_message.push(color::invalid(format!("{invalid_count} invalid")));
}

let term = Term::buffered_stdout();
Expand Down
Loading

0 comments on commit fd50427

Please sign in to comment.