Skip to content

Commit efe3cda

Browse files
committed
echo: remove code made obsolete by MSRV 1.79
1 parent 913d5d4 commit efe3cda

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

src/uu/echo/src/echo.rs

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,6 @@ fn print_escaped(input: &[u8], output: &mut StdoutLock) -> io::Result<ControlFlo
208208
}
209209

210210
if let Some(next) = iter.next() {
211-
// For extending lifetime
212-
// Unnecessary when using Rust >= 1.79.0
213-
// https://github.com/rust-lang/rust/pull/121346
214-
// TODO: when we have a MSRV >= 1.79.0, delete these "hold" bindings
215-
let hold_one_byte_outside_of_match: [u8; 1_usize];
216-
let hold_two_bytes_outside_of_match: [u8; 2_usize];
217-
218211
let unescaped: &[u8] = match *next {
219212
b'\\' => br"\",
220213
b'a' => b"\x07",
@@ -230,12 +223,7 @@ fn print_escaped(input: &[u8], output: &mut StdoutLock) -> io::Result<ControlFlo
230223
if let Some(parsed_hexadecimal_number) =
231224
parse_backslash_number(&mut iter, BackslashNumberType::Hexadecimal)
232225
{
233-
// TODO: remove when we have a MSRV >= 1.79.0
234-
hold_one_byte_outside_of_match = [parsed_hexadecimal_number];
235-
236-
// TODO: when we have a MSRV >= 1.79.0, return reference to a temporary array:
237-
// &[parsed_hexadecimal_number]
238-
&hold_one_byte_outside_of_match
226+
&[parsed_hexadecimal_number]
239227
} else {
240228
// "\x" with any non-hexadecimal digit after means "\x" is treated literally
241229
br"\x"
@@ -246,22 +234,15 @@ fn print_escaped(input: &[u8], output: &mut StdoutLock) -> io::Result<ControlFlo
246234
&mut iter,
247235
BackslashNumberType::OctalStartingWithZero,
248236
) {
249-
// TODO: remove when we have a MSRV >= 1.79.0
250-
hold_one_byte_outside_of_match = [parsed_octal_number];
251-
252-
// TODO: when we have a MSRV >= 1.79.0, return reference to a temporary array:
253-
// &[parsed_octal_number]
254-
&hold_one_byte_outside_of_match
237+
&[parsed_octal_number]
255238
} else {
256239
// "\0" with any non-octal digit after it means "\0" is treated as ASCII '\0' (NUL), 0x00
257240
b"\0"
258241
}
259242
}
260243
other_byte => {
261244
// Backslash and the following byte are treated literally
262-
hold_two_bytes_outside_of_match = [b'\\', other_byte];
263-
264-
&hold_two_bytes_outside_of_match
245+
&[b'\\', other_byte]
265246
}
266247
};
267248

0 commit comments

Comments
 (0)