Skip to content

Commit 909f4da

Browse files
committed
chore: update nom from 7 to 8
1 parent 3037fb5 commit 909f4da

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

Cargo.lock

Lines changed: 2 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async-std = { version = "1.11", features = ["unstable"], optional = true }
2323
base64 = "0.22.1"
2424
futures = "0.3.21"
2525
log = "^0.4"
26-
nom = "^7.0"
26+
nom = "8"
2727
thiserror = "2"
2828
tokio = { version = "1", default-features = false, features = ["time", "io-util"], optional = true }
2929

src/response.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ use nom::{
1111
bytes::streaming::{tag, take_until},
1212
combinator::{complete, map},
1313
multi::many0,
14-
sequence::{preceded, tuple},
15-
IResult,
14+
sequence::preceded,
15+
IResult, Parser as _,
1616
};
1717

1818
use crate::error::Error;
@@ -192,7 +192,8 @@ fn parse_severity(i: &str) -> IResult<&str, Severity> {
192192
map(tag("3"), |_| Severity::PositiveIntermediate),
193193
map(tag("4"), |_| Severity::TransientNegativeCompletion),
194194
map(tag("5"), |_| Severity::PermanentNegativeCompletion),
195-
))(i)
195+
))
196+
.parse(i)
196197
}
197198

198199
fn parse_category(i: &str) -> IResult<&str, Category> {
@@ -203,7 +204,8 @@ fn parse_category(i: &str) -> IResult<&str, Category> {
203204
map(tag("3"), |_| Category::Unspecified3),
204205
map(tag("4"), |_| Category::Unspecified4),
205206
map(tag("5"), |_| Category::MailSystem),
206-
))(i)
207+
))
208+
.parse(i)
207209
}
208210

209211
fn parse_detail(i: &str) -> IResult<&str, Detail> {
@@ -218,18 +220,20 @@ fn parse_detail(i: &str) -> IResult<&str, Detail> {
218220
map(tag("7"), |_| Detail::Seven),
219221
map(tag("8"), |_| Detail::Eight),
220222
map(tag("9"), |_| Detail::Nine),
221-
))(i)
223+
))
224+
.parse(i)
222225
}
223226

224227
pub(crate) fn parse_response(i: &str) -> IResult<&str, Response> {
225-
let (i, lines) = many0(tuple((
228+
let (i, lines) = many0((
226229
parse_code,
227230
preceded(tag("-"), take_until("\r\n")),
228231
tag("\r\n"),
229-
)))(i)?;
232+
))
233+
.parse(i)?;
230234
let (i, (last_code, last_line)) =
231-
tuple((parse_code, preceded(tag(" "), take_until("\r\n"))))(i)?;
232-
let (i, _) = complete(tag("\r\n"))(i)?;
235+
(parse_code, preceded(tag(" "), take_until("\r\n"))).parse(i)?;
236+
let (i, _) = complete(tag("\r\n")).parse(i)?;
233237

234238
// Check that all codes are equal.
235239
if !lines.iter().all(|(code, _, _)| *code == last_code) {

0 commit comments

Comments
 (0)