Skip to content

Commit c5d09de

Browse files
committed
Refactor function signatures to use lifetime annotations for improved clarity
1 parent e40148a commit c5d09de

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

crates/core/src/runtime/context/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ fn parse_store_expr(input: &str) -> nom::IResult<&str, &str, nom::error::Error<&
283283
Ok((input, store))
284284
}
285285

286-
fn context_store_parser(input: &str) -> nom::IResult<&str, ContextKey, nom::error::Error<&str>> {
286+
fn context_store_parser(input: &str) -> nom::IResult<&str, ContextKey<'_>, nom::error::Error<&str>> {
287287
// use crate::text::nom_parsers::*;
288288
use nom::combinator::{opt, rest};
289289

crates/core/src/runtime/model/json/deser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ fn generate_new_xored_id_value(subflow_id: ElementId, old_id: &str) -> crate::Re
327327
Ok(JsonValue::String((subflow_id ^ old_id).to_string()))
328328
}
329329

330-
pub fn parse_red_type_value(t: &str) -> RedElementTypeValue {
330+
pub fn parse_red_type_value(t: &str) -> RedElementTypeValue<'_> {
331331
match t.split_once(':') {
332332
Some((x, y)) => RedElementTypeValue { red_type: x, id: parse_red_id_str(y) },
333333
None => RedElementTypeValue { red_type: t, id: None },

crates/core/src/runtime/model/json/npdeser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ where
110110
}
111111

112112
impl BoolVisitor {
113-
fn convert_to_bool<E>(v: &str) -> Option<Result<<BoolVisitor as Visitor>::Value, E>>
113+
fn convert_to_bool<E>(v: &str) -> Option<Result<<BoolVisitor as Visitor<'_>>::Value, E>>
114114
where
115115
E: Error,
116116
{

crates/core/src/runtime/model/msg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,11 +406,11 @@ impl MsgHandle {
406406
MsgHandle::new(msg)
407407
}
408408

409-
pub async fn read(&self) -> tokio::sync::RwLockReadGuard<Msg> {
409+
pub async fn read(&self) -> tokio::sync::RwLockReadGuard<'_, Msg> {
410410
self.inner.read().await
411411
}
412412

413-
pub async fn write(&self) -> tokio::sync::RwLockWriteGuard<Msg> {
413+
pub async fn write(&self) -> tokio::sync::RwLockWriteGuard<'_, Msg> {
414414
self.inner.write().await
415415
}
416416

crates/core/src/runtime/model/propex.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,15 @@ fn string_literal<'a, E: ParseError<&'a str>>(input: &'a str) -> IResult<&'a str
144144
Ok((input, content))
145145
}
146146

147-
fn first_string_literal_property(i: &str) -> IResult<&str, PropexSegment, nom::error::Error<&str>> {
147+
fn first_string_literal_property(i: &str) -> IResult<&str, PropexSegment<'_>, nom::error::Error<&str>> {
148148
token(string_literal).map(|x| PropexSegment::Property(Cow::Borrowed(x))).parse(i)
149149
}
150150

151-
fn first_direct_property(i: &str) -> IResult<&str, PropexSegment, nom::error::Error<&str>> {
151+
fn first_direct_property(i: &str) -> IResult<&str, PropexSegment<'_>, nom::error::Error<&str>> {
152152
nom_parsers::js_identifier.map(|x| PropexSegment::Property(Cow::Borrowed(x))).parse(i)
153153
}
154154

155-
fn first_property(i: &str) -> IResult<&str, PropexSegment, nom::error::Error<&str>> {
155+
fn first_property(i: &str) -> IResult<&str, PropexSegment<'_>, nom::error::Error<&str>> {
156156
context(
157157
"first_property",
158158
alt((
@@ -167,25 +167,25 @@ fn first_property(i: &str) -> IResult<&str, PropexSegment, nom::error::Error<&st
167167
}
168168

169169
/// `['prop']` or `["prop"]`
170-
fn quoted_index_property(i: &str) -> IResult<&str, PropexSegment, nom::error::Error<&str>> {
170+
fn quoted_index_property(i: &str) -> IResult<&str, PropexSegment<'_>, nom::error::Error<&str>> {
171171
delimited(token(char('[')), string_literal, token(char(']')))
172172
.map(|x| PropexSegment::Property(Cow::Borrowed(x)))
173173
.parse(i)
174174
}
175175

176176
/// `.property`
177-
fn direct_identifier_property(i: &str) -> IResult<&str, PropexSegment, nom::error::Error<&str>> {
177+
fn direct_identifier_property(i: &str) -> IResult<&str, PropexSegment<'_>, nom::error::Error<&str>> {
178178
context("direct_property", preceded(char('.'), nom_parsers::js_identifier))
179179
.map(|x: &str| PropexSegment::Property(Cow::Borrowed(x)))
180180
.parse(i)
181181
}
182182

183183
/// `.123`
184-
fn direct_numbers_index(i: &str) -> IResult<&str, PropexSegment, nom::error::Error<&str>> {
184+
fn direct_numbers_index(i: &str) -> IResult<&str, PropexSegment<'_>, nom::error::Error<&str>> {
185185
context("direct_numbers_index", preceded(token(char('.')), token(parse_usize))).map(PropexSegment::Index).parse(i)
186186
}
187187

188-
fn subproperty(i: &str) -> IResult<&str, PropexSegment, nom::error::Error<&str>> {
188+
fn subproperty(i: &str) -> IResult<&str, PropexSegment<'_>, nom::error::Error<&str>> {
189189
context(
190190
"subproperty",
191191
alt((
@@ -199,13 +199,13 @@ fn subproperty(i: &str) -> IResult<&str, PropexSegment, nom::error::Error<&str>>
199199
.parse(i)
200200
}
201201

202-
fn bracket_index(i: &str) -> IResult<&str, PropexSegment, nom::error::Error<&str>> {
202+
fn bracket_index(i: &str) -> IResult<&str, PropexSegment<'_>, nom::error::Error<&str>> {
203203
context("index", delimited(token(char('[')), token(parse_usize), token(char(']'))))
204204
.map(PropexSegment::Index)
205205
.parse(i)
206206
}
207207

208-
fn nested(i: &str) -> IResult<&str, PropexSegment, nom::error::Error<&str>> {
208+
fn nested(i: &str) -> IResult<&str, PropexSegment<'_>, nom::error::Error<&str>> {
209209
let (i, _) = token(char('[')).parse(i)?;
210210
let (i, first) = first_direct_property.parse(i)?;
211211
let (i, rest) = many1(subproperty).parse(i)?;
@@ -216,7 +216,7 @@ fn nested(i: &str) -> IResult<&str, PropexSegment, nom::error::Error<&str>> {
216216
Ok((i, PropexSegment::Nested(result)))
217217
}
218218

219-
fn expression(input: &str) -> IResult<&str, PropexPath, nom::error::Error<&str>> {
219+
fn expression(input: &str) -> IResult<&str, PropexPath<'_>, nom::error::Error<&str>> {
220220
let (input, first) = first_property.parse(input)?;
221221

222222
let (input, rest) = context(
@@ -238,7 +238,7 @@ fn expression(input: &str) -> IResult<&str, PropexPath, nom::error::Error<&str>>
238238
}
239239
}
240240

241-
pub fn parse(expr: &str) -> Result<PropexPath, PropexError> {
241+
pub fn parse(expr: &str) -> Result<PropexPath<'_>, PropexError> {
242242
if expr.is_empty() {
243243
return Err(PropexError::BadArguments);
244244
}

crates/core/src/runtime/model/variant/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub enum PropexEnv<'a> {
3434
pub trait PropexEnvSliceExt<'a> {
3535
fn find(&self, seg: &str, this: &'a Variant) -> Option<&'a Variant>;
3636
fn find_ext(&self, seg: &str) -> Option<&'a Variant>;
37-
fn find_seg(&self, seg: &str) -> Option<&PropexEnv>;
37+
fn find_seg(&self, seg: &str) -> Option<&PropexEnv<'_>>;
3838
}
3939

4040
#[derive(Debug, Clone)]

crates/pymod/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fn edgelink_pymod(_py: Python, m: &PyModule) -> PyResult<()> {
2828
}
2929

3030
#[pyfunction]
31-
fn rust_sleep(py: Python) -> PyResult<&PyAny> {
31+
fn rust_sleep(py: Python<'_>) -> PyResult<&PyAny> {
3232
pyo3_asyncio::tokio::future_into_py(py, async {
3333
eprintln!("Sleeping in Rust!");
3434
tokio::time::sleep(std::time::Duration::from_secs(1)).await;

0 commit comments

Comments
 (0)