Merge branch 'master' of https://salsa.debian.org/rust-team/debcargo-conf
Peter Michael Green
2 years ago
0 | From: kpcyrd <git@rxv.cc> | |
1 | Date: Sat, 27 Mar 2021 02:13:41 +0100 | |
2 | Subject: Fixes for rust 1.51.0 | |
3 | Origin: upstream, https://github.com/kpcyrd/sniffglue/pull/84/commits/e2244ab2616272faa8ebce18308e146f275250c4 | |
4 | Reviewed-by: Lukas Märdian <slyon@ubuntu.com> | |
5 | ||
6 | Fix autopkgtests by backporting upstream changes to fmt.rs | |
7 | --- | |
8 | src/fmt.rs | 20 ++++++++------------ | |
9 | 1 file changed, 8 insertions(+), 12 deletions(-) | |
10 | ||
11 | diff --git a/src/fmt.rs b/src/fmt.rs | |
12 | index 3c2edc4..7c1e011 100644 | |
13 | --- a/src/fmt.rs | |
14 | +++ b/src/fmt.rs | |
15 | @@ -328,9 +328,8 @@ impl Format { | |
16 | Request(req) => { | |
17 | out.push_str("[dns] req, "); | |
18 | ||
19 | - match req.questions.iter() | |
20 | - .map(|x| format!("{:?}", x)) | |
21 | - .reduce(|a, b| a + &align(out.len(), &b)) | |
22 | + match Reduce::reduce(req.questions.iter() | |
23 | + .map(|x| format!("{:?}", x)), |a, b| a + &align(out.len(), &b)) | |
24 | { | |
25 | Some(dns) => out.push_str(&dns), | |
26 | None => out.push_str("[]"), | |
27 | @@ -339,9 +338,8 @@ impl Format { | |
28 | Response(resp) => { | |
29 | out.push_str("[dns] resp, "); | |
30 | ||
31 | - match resp.answers.iter() | |
32 | - .map(|x| format!("{:?}", x)) | |
33 | - .reduce(|a, b| a + &align(out.len(), &b)) | |
34 | + match Reduce::reduce(resp.answers.iter() | |
35 | + .map(|x| format!("{:?}", x)), |a, b| a + &align(out.len(), &b)) | |
36 | { | |
37 | Some(dns) => out.push_str(&dns), | |
38 | None => out.push_str("[]"), | |
39 | @@ -534,13 +532,12 @@ fn display_macadr_buf(mac: [u8; 6]) -> String { | |
40 | ||
41 | #[inline] | |
42 | fn display_kv_list(list: &[(&str, Option<&str>)]) -> String { | |
43 | - list.iter() | |
44 | + Reduce::reduce(list.iter() | |
45 | .filter_map(|&(key, ref value)| { | |
46 | value.as_ref().map(|value| { | |
47 | format!("{}: {:?}", key, value) | |
48 | }) | |
49 | - }) | |
50 | - .reduce(|a, b| a + ", " + &b) | |
51 | + }), |a, b| a + ", " + &b) | |
52 | .map(|extra| format!(" ({})", extra)) | |
53 | .unwrap_or_else(String::new) | |
54 | } | |
55 | @@ -570,11 +567,10 @@ impl<'a> DhcpKvListWriter<'a> { | |
56 | } | |
57 | ||
58 | fn finalize(self) -> String { | |
59 | - self.elements.iter() | |
60 | + Reduce::reduce(self.elements.iter() | |
61 | .map(|&(key, ref value)| { | |
62 | format!("{}: {}", key, value) | |
63 | - }) | |
64 | - .reduce(|a, b| a + ", " + &b) | |
65 | + }), |a, b| a + ", " + &b) | |
66 | .map(|extra| format!(" ({})", extra)) | |
67 | .unwrap_or_else(String::new) | |
68 | } |