diff --git a/Cargo.toml b/Cargo.toml index de08d5c..50c857b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,6 +56,7 @@ pedantic = { level = "deny", priority = -1 } allow_attributes = "deny" as_conversions = "deny" as_underscore = "forbid" +as_pointer_underscore = "forbid" assertions_on_result_states = "deny" big_endian_bytes = "forbid" cfg_not_test = "forbid" @@ -65,6 +66,7 @@ dbg_macro = "forbid" decimal_literal_representation = "forbid" default_numeric_fallback = "forbid" doc_include_without_cfg = "forbid" +else_if_without_else = "forbid" empty_drop = "forbid" error_impl_error = "deny" exit = "forbid" @@ -82,6 +84,7 @@ integer_division = "deny" integer_division_remainder_used = "deny" iter_over_hash_type = "deny" let_underscore_must_use = "forbid" +let_underscore_untyped = "forbid" lossy_float_literal = "forbid" map_err_ignore = "forbid" map_with_unused_argument_over_ranges = "forbid" @@ -108,6 +111,7 @@ rc_mutex = "forbid" redundant_type_annotations = "forbid" ref_patterns = "forbid" rest_pat_in_fully_bound_structs = "forbid" +return_and_then = "forbid" str_to_string = "forbid" string_lit_chars_any = "forbid" string_slice = "forbid" diff --git a/ffi/src/helpers.rs b/ffi/src/helpers.rs index 1f66f19..a1e82df 100644 --- a/ffi/src/helpers.rs +++ b/ffi/src/helpers.rs @@ -98,8 +98,9 @@ pub(crate) unsafe fn to_path_buf_vec( } unsafe fn map_plugin_version(c_object: &plugin_version) -> Result<(String, String), c_int> { - to_str(c_object.plugin_name) - .and_then(|n| to_str(c_object.version).map(|v| (n.into(), v.into()))) + let name = to_str(c_object.plugin_name)?; + + to_str(c_object.version).map(|v| (name.into(), v.into())) } pub(crate) unsafe fn map_plugin_versions( diff --git a/src/lib.rs b/src/lib.rs index aca7ee5..c82fca9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -187,15 +187,13 @@ impl str::FromStr for Expression { type Err = Error; fn from_str(s: &str) -> Result { - parse_expression(s) - .map_err(Error::from) - .and_then(|(remaining_input, expression)| { - if remaining_input.is_empty() { - Ok(expression) - } else { - Err(Error::UnconsumedInput(remaining_input.to_owned())) - } - }) + let (remaining_input, expression) = parse_expression(s)?; + + if remaining_input.is_empty() { + Ok(expression) + } else { + Err(Error::UnconsumedInput(remaining_input.to_owned())) + } } }