Skip to content

Commit cc0eaa6

Browse files
authored
Update to 2024 edition (#1076)
1 parent 8a8bc79 commit cc0eaa6

39 files changed

Lines changed: 117 additions & 112 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ resolver = "2"
1818
[workspace.package]
1919
version = "7.0.1"
2020
authors = ["The Javy Project Developers"]
21-
edition = "2021"
21+
edition = "2024"
2222
license = "Apache-2.0 WITH LLVM-exception"
2323

2424
[workspace.dependencies]

crates/cli/src/commands.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
use crate::{
2+
CliPlugin, WitOptions,
23
js_config::{ConfigSchema, JsConfig},
34
option::OptionMeta,
4-
option_group, CliPlugin, WitOptions,
5+
option_group,
56
};
6-
use anyhow::{anyhow, bail, Result};
7+
use anyhow::{Result, anyhow, bail};
78
use clap::{
9+
CommandFactory, Parser, Subcommand,
810
builder::{StringValueParser, TypedValueParser, ValueParserFactory},
911
error::ErrorKind,
10-
CommandFactory, Parser, Subcommand,
1112
};
1213
use std::{
1314
collections::{HashMap, HashSet},
1415
path::PathBuf,
1516
};
1617

1718
use crate::option::{
18-
fmt_help, GroupDescriptor, GroupOption, GroupOptionBuilder, GroupOptionParser, OptionValue,
19+
GroupDescriptor, GroupOption, GroupOptionBuilder, GroupOptionParser, OptionValue, fmt_help,
1920
};
2021

2122
#[derive(Debug, Parser)]
@@ -378,10 +379,10 @@ mod tests {
378379
use std::path::PathBuf;
379380

380381
use crate::{
382+
CliPlugin, Plugin, PluginKind,
381383
commands::{JsGroupOption, JsGroupValue, Source},
382384
js_config::JsConfig,
383385
plugin::PLUGIN_MODULE,
384-
CliPlugin, Plugin, PluginKind,
385386
};
386387

387388
use super::{CodegenOption, CodegenOptionGroup, GroupOption};

crates/cli/src/js_config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use anyhow::{anyhow, Result};
1+
use anyhow::{Result, anyhow};
22
use serde::Deserialize;
33
use std::{collections::HashMap, str};
44
use wasmtime::{AsContext, AsContextMut, Engine, Linker};

crates/cli/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ use anyhow::Result;
88
use clap::Parser;
99

1010
use commands::CodegenOptionGroup;
11-
use javy_codegen::{Generator, LinkingKind, Plugin, SourceEmbedding, WitOptions, JS};
11+
use javy_codegen::{Generator, JS, LinkingKind, Plugin, SourceEmbedding, WitOptions};
1212
use js_config::JsConfig;
13-
use plugin::{CliPlugin, PluginKind, UninitializedPlugin, PLUGIN_MODULE};
13+
use plugin::{CliPlugin, PLUGIN_MODULE, PluginKind, UninitializedPlugin};
1414
use std::fs;
1515
use std::fs::File;
1616
use std::io::Write;

crates/cli/src/option.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use anyhow::{bail, Result};
1+
use anyhow::{Result, bail};
22
use std::path::PathBuf;
33

44
use crate::commands;

crates/cli/src/plugin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use anyhow::{bail, Result};
1+
use anyhow::{Result, bail};
22
use javy_codegen::Plugin;
33

44
pub const PLUGIN_MODULE: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/plugin.wasm"));

crates/cli/tests/dynamic_linking_test.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ fn test_errors_in_exported_functions_are_correctly_reported(builder: &mut Builde
4848

4949
let res = runner.exec_func("foo", vec![]);
5050

51-
assert!(res
52-
.err()
53-
.unwrap()
54-
.to_string()
55-
.contains("error while executing"));
51+
assert!(
52+
res.err()
53+
.unwrap()
54+
.to_string()
55+
.contains("error while executing")
56+
);
5657
Ok(())
5758
}
5859

@@ -79,9 +80,10 @@ fn test_producers_section_present(builder: &mut Builder) -> Result<()> {
7980
#[javy_cli_test(dyn = true, root = "tests/dynamic-linking-scripts")]
8081
fn test_using_runtime_flag_with_dynamic_triggers_error(builder: &mut Builder) -> Result<()> {
8182
let build_result = builder.input("console.js").text_encoding(false).build();
82-
assert!(build_result.is_err_and(|e| e
83-
.to_string()
84-
.contains("error: Property text-encoding is not supported for runtime configuration")));
83+
assert!(build_result.is_err_and(|e| {
84+
e.to_string()
85+
.contains("error: Property text-encoding is not supported for runtime configuration")
86+
}));
8587
Ok(())
8688
}
8789

crates/cli/tests/integration_test.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use anyhow::{bail, Result};
1+
use anyhow::{Result, bail};
22
use javy_runner::{Builder, Plugin, Runner, RunnerError, Source};
33
use std::{io::Read, path::PathBuf, process::Command, str};
44
use wasmtime::{AsContextMut, Engine, Linker, Module, Store};
@@ -150,9 +150,10 @@ fn test_using_wasip1_plugin_with_static_build_fails_with_runtime_config(
150150
.simd_json_builtins(true)
151151
.build();
152152
let err = result.err().unwrap();
153-
assert!(err
154-
.to_string()
155-
.contains("Property simd-json-builtins is not supported for runtime configuration"));
153+
assert!(
154+
err.to_string()
155+
.contains("Property simd-json-builtins is not supported for runtime configuration")
156+
);
156157

157158
Ok(())
158159
}
@@ -166,9 +167,10 @@ fn test_using_wasip2_plugin_with_static_build_fails_with_runtime_config(
166167
.simd_json_builtins(true)
167168
.build();
168169
let err = result.err().unwrap();
169-
assert!(err
170-
.to_string()
171-
.contains("Property simd-json-builtins is not supported for runtime configuration"));
170+
assert!(
171+
err.to_string()
172+
.contains("Property simd-json-builtins is not supported for runtime configuration")
173+
);
172174

173175
Ok(())
174176
}

crates/codegen/src/bytecode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use anyhow::{anyhow, bail, Result};
1+
use anyhow::{Result, anyhow, bail};
22
use wasmtime::{AsContext, AsContextMut, Engine, Instance, Linker, Memory, Module, Store};
33

44
use crate::Plugin;

crates/codegen/src/exports.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use anyhow::{anyhow, Result};
1+
use anyhow::{Result, anyhow};
22
use convert_case::{Case, Casing};
33
use std::path::Path;
44

0 commit comments

Comments
 (0)