Skip to content

Commit

Permalink
Showing 10 changed files with 28 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
exclude: ^misc/bench.py$

default_language_version:
rust: 1.71.1
rust: 1.72.1
node: 18.12.0

repos:
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@ default-members = [
"libparsec/crates/tests_macros",
"libparsec/crates/types",
]
resolver = "2"

# Define values to be inherited by workspace members.
#
11 changes: 6 additions & 5 deletions bindings/electron/src/meths.rs
Original file line number Diff line number Diff line change
@@ -1056,11 +1056,12 @@ fn struct_human_handle_js_to_rs<'a>(
let js_val: Handle<JsString> = obj.get(cx, "label")?;
js_val.value(cx)
};

|email: String, label: String| -> Result<_, String> {
libparsec::HumanHandle::new(&email, &label).map_err(|e| e.to_string())
}(email, label)
.or_else(|e| cx.throw_error(e))
{
let custom_init = |email: String, label: String| -> Result<_, String> {
libparsec::HumanHandle::new(&email, &label).map_err(|e| e.to_string())
};
custom_init(email, label).or_else(|e| cx.throw_error(e))
}
}

#[allow(dead_code)]
5 changes: 4 additions & 1 deletion bindings/generator/templates/binding_electron_meths.rs.j2
Original file line number Diff line number Diff line change
@@ -406,7 +406,10 @@ fn {{ struct_js_to_rs_function_name(struct) }}<'a>(
{{ struct.list_attributes() }}
})
{% else %}
{{ struct.custom_init }}({{ struct.list_attributes() }}).or_else(|e| cx.throw_error(e))
{
let custom_init = {{ struct.custom_init }};
custom_init({{ struct.list_attributes() }}).or_else(|e| cx.throw_error(e))
}
{% endif%}
}
{% endmacro -%}
5 changes: 4 additions & 1 deletion bindings/generator/templates/binding_web_meths.rs.j2
Original file line number Diff line number Diff line change
@@ -411,7 +411,10 @@ fn {{ struct_js_to_rs_function_name(struct) }}(obj: JsValue) -> Result<libparsec
{{ struct.list_attributes() }}
})
{% else %}
{{ struct.custom_init }}({{ struct.list_attributes() }}).map_err(|e| e.into())
{
let custom_init = {{ struct.custom_init }};
custom_init({{ struct.list_attributes() }}).map_err(|e| e.into())
}
{% endif %}
}
{% endmacro -%}
11 changes: 6 additions & 5 deletions bindings/web/src/meths.rs
Original file line number Diff line number Diff line change
@@ -1124,11 +1124,12 @@ fn struct_human_handle_js_to_rs(obj: JsValue) -> Result<libparsec::HumanHandle,
.and_then(|s| s.as_string())
.ok_or_else(|| TypeError::new("Not a string"))?
};

|email: String, label: String| -> Result<_, String> {
libparsec::HumanHandle::new(&email, &label).map_err(|e| e.to_string())
}(email, label)
.map_err(|e| e.into())
{
let custom_init = |email: String, label: String| -> Result<_, String> {
libparsec::HumanHandle::new(&email, &label).map_err(|e| e.to_string())
};
custom_init(email, label).map_err(|e| e.into())
}
}

#[allow(dead_code)]
3 changes: 2 additions & 1 deletion libparsec/crates/client/src/workspace_ops/merge.rs
Original file line number Diff line number Diff line change
@@ -72,7 +72,8 @@ macro_rules! merge_local_xxx_manifest {
// that would be considered as bug :/
// - the fixtures and backend data binder system used in the tests
// makes it much more likely
if $remote.author == *$local_author && !$is_speculative_fn($local) {
let is_speculative_fn = $is_speculative_fn;
if $remote.author == *$local_author && !is_speculative_fn($local) {
let mut new_local = $local.to_owned();
new_local.base = $remote;
return Some(new_local);
3 changes: 2 additions & 1 deletion libparsec/crates/testbed/src/template/events.rs
Original file line number Diff line number Diff line change
@@ -85,7 +85,8 @@ macro_rules! impl_certificates_meth_for_single_certificate {
) -> impl Iterator<Item = TestbedTemplateEventCertificate> + 'c {
std::iter::once(()).map(move |_| {
let mut guard = self.cache.lock().expect("Mutex is poisoned");
let populate = || $populate(self, template);
let populate_fn = $populate;
let populate = || populate_fn(self, template);
guard.populated(populate).to_owned()
})
}
2 changes: 1 addition & 1 deletion misc/version_updater.py
Original file line number Diff line number Diff line change
@@ -65,7 +65,7 @@ class Tool(enum.Enum):


TOOLS_VERSION: Dict[Tool, str] = {
Tool.Rust: "1.71.1",
Tool.Rust: "1.72.1",
Tool.Python: "3.9.10",
Tool.Poetry: "1.5.1",
Tool.Node: "18.12.0",
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "1.71.1"
channel = "1.72.1"
# The default profile includes rustc, rust-std, cargo, rust-docs, rustfmt and clippy.
# https://rust-lang.github.io/rustup/concepts/profiles.html
profile = "default"

0 comments on commit e0c4cfa

Please sign in to comment.