Skip to content

Commit 9c157ba

Browse files
thaliaarchigitbot
authored and
gitbot
committed
Fix long lines which rustfmt fails to format
rustfmt fails to format this match expression, because it has several long string literals over the maximum line width. This seems to exhibit rustfmt issues rust-lang#3863 (Gives up on chains if any line is too long) and rust-lang#3156 (Fail to format match arm when other arm has long line).
1 parent 91e69c8 commit 9c157ba

File tree

1 file changed

+45
-106
lines changed
  • std/src/sys/pal/uefi

1 file changed

+45
-106
lines changed

std/src/sys/pal/uefi/os.rs

+45-106
Original file line numberDiff line numberDiff line change
@@ -17,111 +17,50 @@ pub fn errno() -> RawOsError {
1717
pub fn error_string(errno: RawOsError) -> String {
1818
// Keep the List in Alphabetical Order
1919
// The Messages are taken from UEFI Specification Appendix D - Status Codes
20-
match r_efi::efi::Status::from_usize(errno) {
21-
Status::ABORTED => "The operation was aborted.".to_owned(),
22-
Status::ACCESS_DENIED => "Access was denied.".to_owned(),
23-
Status::ALREADY_STARTED => "The protocol has already been started.".to_owned(),
24-
Status::BAD_BUFFER_SIZE => "The buffer was not the proper size for the request.".to_owned(),
25-
Status::BUFFER_TOO_SMALL => {
26-
"The buffer is not large enough to hold the requested data. The required buffer size is returned in the appropriate parameter when this error occurs.".to_owned()
27-
}
28-
Status::COMPROMISED_DATA => {
29-
"The security status of the data is unknown or compromised and the data must be updated or replaced to restore a valid security status.".to_owned()
30-
}
31-
Status::CONNECTION_FIN => {
32-
"The receiving operation fails because the communication peer has closed the connection and there is no more data in the receive buffer of the instance.".to_owned()
33-
}
34-
Status::CONNECTION_REFUSED => {
35-
"The receiving or transmission operation fails because this connection is refused.".to_owned()
36-
}
37-
Status::CONNECTION_RESET => {
38-
"The connect fails because the connection is reset either by instance itself or the communication peer.".to_owned()
39-
}
40-
Status::CRC_ERROR => "A CRC error was detected.".to_owned(),
41-
Status::DEVICE_ERROR => "The physical device reported an error while attempting the operation.".to_owned()
42-
,
43-
Status::END_OF_FILE => {
44-
"The end of the file was reached.".to_owned()
45-
}
46-
Status::END_OF_MEDIA => {
47-
"Beginning or end of media was reached".to_owned()
48-
}
49-
Status::HOST_UNREACHABLE => {
50-
"The remote host is not reachable.".to_owned()
51-
}
52-
Status::HTTP_ERROR => {
53-
"A HTTP error occurred during the network operation.".to_owned()
54-
}
55-
Status::ICMP_ERROR => {
56-
"An ICMP error occurred during the network operation.".to_owned()
57-
}
58-
Status::INCOMPATIBLE_VERSION => {
59-
"The function encountered an internal version that was incompatible with a version requested by the caller.".to_owned()
60-
}
61-
Status::INVALID_LANGUAGE => {
62-
"The language specified was invalid.".to_owned()
63-
}
64-
Status::INVALID_PARAMETER => {
65-
"A parameter was incorrect.".to_owned()
66-
}
67-
Status::IP_ADDRESS_CONFLICT => {
68-
"There is an address conflict address allocation".to_owned()
69-
}
70-
Status::LOAD_ERROR => {
71-
"The image failed to load.".to_owned()
72-
}
73-
Status::MEDIA_CHANGED => {
74-
"The medium in the device has changed since the last access.".to_owned()
75-
}
76-
Status::NETWORK_UNREACHABLE => {
77-
"The network containing the remote host is not reachable.".to_owned()
78-
}
79-
Status::NO_MAPPING => {
80-
"A mapping to a device does not exist.".to_owned()
81-
}
82-
Status::NO_MEDIA => {
83-
"The device does not contain any medium to perform the operation.".to_owned()
84-
}
85-
Status::NO_RESPONSE => {
86-
"The server was not found or did not respond to the request.".to_owned()
87-
}
88-
Status::NOT_FOUND => "The item was not found.".to_owned(),
89-
Status::NOT_READY => {
90-
"There is no data pending upon return.".to_owned()
91-
}
92-
Status::NOT_STARTED => {
93-
"The protocol has not been started.".to_owned()
94-
}
95-
Status::OUT_OF_RESOURCES => {
96-
"A resource has run out.".to_owned()
97-
}
98-
Status::PROTOCOL_ERROR => {
99-
"A protocol error occurred during the network operation.".to_owned()
100-
}
101-
Status::PROTOCOL_UNREACHABLE => {
102-
"An ICMP protocol unreachable error is received.".to_owned()
103-
}
104-
Status::SECURITY_VIOLATION => {
105-
"The function was not performed due to a security violation.".to_owned()
106-
}
107-
Status::TFTP_ERROR => {
108-
"A TFTP error occurred during the network operation.".to_owned()
109-
}
110-
Status::TIMEOUT => "The timeout time expired.".to_owned(),
111-
Status::UNSUPPORTED => {
112-
"The operation is not supported.".to_owned()
113-
}
114-
Status::VOLUME_FULL => {
115-
"There is no more space on the file system.".to_owned()
116-
}
117-
Status::VOLUME_CORRUPTED => {
118-
"An inconstancy was detected on the file system causing the operating to fail.".to_owned()
119-
}
120-
Status::WRITE_PROTECTED => {
121-
"The device cannot be written to.".to_owned()
122-
}
123-
_ => format!("Status: {}", errno),
124-
}
20+
#[rustfmt::skip]
21+
let msg = match r_efi::efi::Status::from_usize(errno) {
22+
Status::ABORTED => "The operation was aborted.",
23+
Status::ACCESS_DENIED => "Access was denied.",
24+
Status::ALREADY_STARTED => "The protocol has already been started.",
25+
Status::BAD_BUFFER_SIZE => "The buffer was not the proper size for the request.",
26+
Status::BUFFER_TOO_SMALL => "The buffer is not large enough to hold the requested data. The required buffer size is returned in the appropriate parameter when this error occurs.",
27+
Status::COMPROMISED_DATA => "The security status of the data is unknown or compromised and the data must be updated or replaced to restore a valid security status.",
28+
Status::CONNECTION_FIN => "The receiving operation fails because the communication peer has closed the connection and there is no more data in the receive buffer of the instance.",
29+
Status::CONNECTION_REFUSED => "The receiving or transmission operation fails because this connection is refused.",
30+
Status::CONNECTION_RESET => "The connect fails because the connection is reset either by instance itself or the communication peer.",
31+
Status::CRC_ERROR => "A CRC error was detected.",
32+
Status::DEVICE_ERROR => "The physical device reported an error while attempting the operation.",
33+
Status::END_OF_FILE => "The end of the file was reached.",
34+
Status::END_OF_MEDIA => "Beginning or end of media was reached",
35+
Status::HOST_UNREACHABLE => "The remote host is not reachable.",
36+
Status::HTTP_ERROR => "A HTTP error occurred during the network operation.",
37+
Status::ICMP_ERROR => "An ICMP error occurred during the network operation.",
38+
Status::INCOMPATIBLE_VERSION => "The function encountered an internal version that was incompatible with a version requested by the caller.",
39+
Status::INVALID_LANGUAGE => "The language specified was invalid.",
40+
Status::INVALID_PARAMETER => "A parameter was incorrect.",
41+
Status::IP_ADDRESS_CONFLICT => "There is an address conflict address allocation",
42+
Status::LOAD_ERROR => "The image failed to load.",
43+
Status::MEDIA_CHANGED => "The medium in the device has changed since the last access.",
44+
Status::NETWORK_UNREACHABLE => "The network containing the remote host is not reachable.",
45+
Status::NO_MAPPING => "A mapping to a device does not exist.",
46+
Status::NO_MEDIA => "The device does not contain any medium to perform the operation.",
47+
Status::NO_RESPONSE => "The server was not found or did not respond to the request.",
48+
Status::NOT_FOUND => "The item was not found.",
49+
Status::NOT_READY => "There is no data pending upon return.",
50+
Status::NOT_STARTED => "The protocol has not been started.",
51+
Status::OUT_OF_RESOURCES => "A resource has run out.",
52+
Status::PROTOCOL_ERROR => "A protocol error occurred during the network operation.",
53+
Status::PROTOCOL_UNREACHABLE => "An ICMP protocol unreachable error is received.",
54+
Status::SECURITY_VIOLATION => "The function was not performed due to a security violation.",
55+
Status::TFTP_ERROR => "A TFTP error occurred during the network operation.",
56+
Status::TIMEOUT => "The timeout time expired.",
57+
Status::UNSUPPORTED => "The operation is not supported.",
58+
Status::VOLUME_FULL => "There is no more space on the file system.",
59+
Status::VOLUME_CORRUPTED => "An inconstancy was detected on the file system causing the operating to fail.",
60+
Status::WRITE_PROTECTED => "The device cannot be written to.",
61+
_ => return format!("Status: {errno}"),
62+
};
63+
msg.to_owned()
12564
}
12665

12766
pub fn getcwd() -> io::Result<PathBuf> {
@@ -314,7 +253,7 @@ mod uefi_env {
314253

315254
let mut start = 0;
316255

317-
// UEFI Shell returns all keys seperated by NULL.
256+
// UEFI Shell returns all keys separated by NULL.
318257
// End of string is denoted by two NULLs
319258
for i in 0.. {
320259
if unsafe { *val.add(i) } == 0 {

0 commit comments

Comments
 (0)