Skip to content

Commit c8006e5

Browse files
Bump nom from 7.1.3 to 8.0.0 (#551)
* Bump nom from 7.1.3 to 8.0.0 Bumps [nom](https://github.com/rust-bakery/nom) from 7.1.3 to 8.0.0. - [Changelog](https://github.com/rust-bakery/nom/blob/main/CHANGELOG.md) - [Commits](rust-bakery/nom@7.1.3...8.0.0) --- updated-dependencies: - dependency-name: nom dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Migrate to nom 8.0.0 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Chitoku <odango@chitoku.jp>
1 parent 605b7c2 commit c8006e5

File tree

9 files changed

+107
-115
lines changed

9 files changed

+107
-115
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
@@ -80,7 +80,7 @@ features = ["serde"]
8080
version = "0.4.25"
8181

8282
[dependencies.nom]
83-
version = "7.1.3"
83+
version = "8.0.0"
8484

8585
[dependencies.notify]
8686
version = "8.0.0"

src/infrastructure/cmd/parser.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use nom::{
77
character::complete::u64,
88
combinator::map,
99
error::Error,
10-
sequence::{terminated, tuple},
11-
Finish, IResult,
10+
sequence::terminated,
11+
Finish, IResult, Parser as _,
1212
};
1313

1414
pub mod bgp;
@@ -40,36 +40,36 @@ impl FromStr for Duration {
4040
fn parse_duration(input: &str) -> IResult<&str, time::Duration> {
4141
alt((
4242
map(
43-
tuple((
43+
(
4444
terminated(u64, tag(":")),
4545
terminated(u64, tag(":")),
4646
u64,
47-
)),
47+
),
4848
|(h, m, s)| time::Duration::new(h * 60 * 60 + m * 60 + s, 0),
4949
),
5050
map(
51-
tuple((
51+
(
5252
terminated(u64, tag("h")),
5353
terminated(u64, tag("m")),
5454
terminated(u64, tag("s")),
55-
)),
55+
),
5656
|(h, m, s)| time::Duration::new(h * 60 * 60 + m * 60 + s, 0),
5757
),
5858
map(
59-
tuple((
59+
(
6060
terminated(u64, tag("w")),
6161
terminated(u64, tag("d")),
6262
terminated(u64, tag("h")),
63-
)),
63+
),
6464
|(w, d, h)| time::Duration::new(w * 7 * 24 * 60 * 60 + d * 24 * 60 * 60 + h * 60 * 60, 0),
6565
),
6666
map(
67-
tuple((
67+
(
6868
terminated(u64, tag("d")),
6969
terminated(u64, tag("h")),
7070
terminated(u64, tag("m")),
71-
)),
71+
),
7272
|(d, h, m)| time::Duration::new(d * 24 * 60 * 60 + h * 60 * 60 + m * 60, 0),
7373
),
74-
))(input)
74+
)).parse_complete(input)
7575
}

src/infrastructure/cmd/parser/bgp.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use nom::{
88
combinator::{eof, map, map_res, opt},
99
error::Error,
1010
multi::{many0, many1, many_till, separated_list1},
11-
sequence::{delimited, terminated, tuple},
12-
Finish, IResult,
11+
sequence::{delimited, terminated},
12+
Finish, IResult, Parser as _,
1313
};
1414

1515
use crate::{
@@ -80,43 +80,43 @@ fn parse_bgp_neighbor(header: &[&str], line: &[&str]) -> anyhow::Result<BGPNeigh
8080
fn parse_bgp_status(input: &str) -> IResult<&str, BGPStatusResult> {
8181
alt((
8282
map(
83-
tuple((multispace0, eof)),
83+
(multispace0, eof),
8484
|_| None,
8585
),
8686
map(
8787
permutation((
88-
tuple((
88+
(
8989
delimited(
90-
tuple((tag("BGP router identifier"), space1)),
90+
(tag("BGP router identifier"), space1),
9191
map(take_until(","), &str::to_string),
92-
tuple((tag(","), space1)),
92+
(tag(","), space1),
9393
),
9494
delimited(
95-
tuple((tag("local AS number"), space1)),
95+
(tag("local AS number"), space1),
9696
u32,
9797
many1(newline),
9898
),
99-
)),
99+
),
100100
delimited(
101-
tuple((tag("BGP table version is"), space1)),
101+
(tag("BGP table version is"), space1),
102102
u32,
103103
many1(newline),
104104
),
105105
terminated(
106106
u64,
107-
tuple((space1, tag("BGP AS-PATH entries"), many1(newline))),
107+
(space1, tag("BGP AS-PATH entries"), many1(newline)),
108108
),
109109
terminated(
110110
u64,
111-
tuple((space1, tag("BGP community entries"), many1(newline))),
111+
(space1, tag("BGP community entries"), many1(newline)),
112112
),
113113
opt(terminated(
114114
u64,
115-
tuple((space1, tag("Configured ebgp ECMP multipath"), not_line_ending, many1(newline))),
115+
(space1, tag("Configured ebgp ECMP multipath"), not_line_ending, many1(newline)),
116116
)),
117117
opt(terminated(
118118
u64,
119-
tuple((space1, tag("Configured ibgp ECMP multipath"), not_line_ending, many1(newline))),
119+
(space1, tag("Configured ibgp ECMP multipath"), not_line_ending, many1(newline)),
120120
)),
121121
map_res(
122122
many_till(
@@ -135,12 +135,12 @@ fn parse_bgp_status(input: &str) -> IResult<&str, BGPStatusResult> {
135135
},
136136
),
137137
delimited(
138-
tuple((tag("Total number of neighbors"), space1)),
138+
(tag("Total number of neighbors"), space1),
139139
u64,
140140
many0(newline),
141141
),
142142
delimited(
143-
tuple((tag("Total number of Established sessions"), space1)),
143+
(tag("Total number of Established sessions"), space1),
144144
u64,
145145
many0(newline),
146146
),
@@ -169,7 +169,7 @@ fn parse_bgp_status(input: &str) -> IResult<&str, BGPStatusResult> {
169169
})
170170
},
171171
),
172-
))(input)
172+
)).parse_complete(input)
173173
}
174174

175175
#[cfg(test)]

src/infrastructure/cmd/parser/ddns.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use nom::{
77
combinator::{map, map_res, opt},
88
error::Error,
99
multi::many1,
10-
sequence::{delimited, terminated, tuple},
11-
Finish, IResult,
10+
sequence::{delimited, terminated},
11+
Finish, IResult, Parser as _,
1212
};
1313

1414
use crate::{
@@ -43,28 +43,28 @@ fn parse_ddns_status(input: &str) -> IResult<&str, DdnsStatusResult> {
4343
map(
4444
permutation((
4545
delimited(
46-
tuple((tag("interface"), space0, tag(":"), space1)),
46+
(tag("interface"), space0, tag(":"), space1),
4747
map(take_till(|c| c == ' ' || c == '\n'), &str::to_string),
48-
tuple((not_line_ending, newline)),
48+
(not_line_ending, newline),
4949
),
5050
opt(delimited(
51-
tuple((tag("ip address"), space0, tag(":"), space1)),
51+
(tag("ip address"), space0, tag(":"), space1),
5252
map_res(not_line_ending, &str::parse),
5353
newline,
5454
)),
5555
opt(delimited(
56-
tuple((tag("host-name"), space0, tag(":"), space1)),
56+
(tag("host-name"), space0, tag(":"), space1),
5757
map(not_line_ending, &str::to_string),
5858
newline,
5959
)),
6060
opt(delimited(
61-
tuple((tag("last update"), space0, tag(":"), space1)),
61+
(tag("last update"), space0, tag(":"), space1),
6262
map_res(not_line_ending, |s| NaiveDateTime::parse_from_str(s, "%a %b %e %H:%M:%S %Y")),
6363
newline,
6464
)),
6565
map(
6666
opt(delimited(
67-
tuple((tag("update-status"), space0, tag(":"), space1)),
67+
(tag("update-status"), space0, tag(":"), space1),
6868
opt(
6969
map(alphanumeric1::<&str, _>, |s| {
7070
match s.to_ascii_lowercase().as_str() {
@@ -128,7 +128,7 @@ fn parse_ddns_status(input: &str) -> IResult<&str, DdnsStatusResult> {
128128
many1(line_ending),
129129
),
130130
),
131-
))(input)
131+
)).parse_complete(input)
132132
}
133133

134134
#[cfg(test)]

src/infrastructure/cmd/parser/interface.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use nom::{
88
combinator::{map, map_res},
99
error::Error,
1010
multi::many0,
11-
sequence::{separated_pair, terminated, tuple},
12-
Finish, IResult,
11+
sequence::{separated_pair, terminated},
12+
Finish, IResult, Parser as _,
1313
};
1414

1515
use crate::{
@@ -38,21 +38,21 @@ fn parse_cidr(input: &str) -> IResult<&str, (IpAddr, u32)> {
3838
parse_ip_address,
3939
tag("/"),
4040
u32,
41-
)(input)
41+
).parse_complete(input)
4242
}
4343

4444
fn parse_ip_address(input: &str) -> IResult<&str, IpAddr> {
4545
alt((
4646
map_res(take_while(|c| c == '.' || char::is_digit(c, 10)), &str::parse),
4747
map_res(take_while(|c| c == ':' || char::is_digit(c, 16)), &str::parse),
48-
))(input)
48+
)).parse_complete(input)
4949
}
5050

5151
fn parse_interfaces(input: &str) -> IResult<&str, InterfaceResult> {
5252
many0(
5353
terminated(
5454
map(
55-
tuple((
55+
(
5656
terminated(
5757
map(take_till(|c| c == ' '), &str::to_string),
5858
space1,
@@ -67,7 +67,7 @@ fn parse_interfaces(input: &str) -> IResult<&str, InterfaceResult> {
6767
map(
6868
separated_pair(
6969
parse_ip_address,
70-
tuple((space1, tag("peer"), space1)),
70+
(space1, tag("peer"), space1),
7171
parse_cidr,
7272
),
7373
|(local, (address, prefixlen))| {
@@ -106,7 +106,7 @@ fn parse_interfaces(input: &str) -> IResult<&str, InterfaceResult> {
106106
space0,
107107
),
108108
),
109-
)),
109+
),
110110
|(ifname, operstate, addr_info)| {
111111
Interface {
112112
ifname,
@@ -117,7 +117,7 @@ fn parse_interfaces(input: &str) -> IResult<&str, InterfaceResult> {
117117
),
118118
multispace1,
119119
),
120-
)(input)
120+
).parse_complete(input)
121121
}
122122

123123
#[cfg(test)]

0 commit comments

Comments
 (0)