Skip to content

Commit 24f7868

Browse files
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 #3863 (Gives up on chains if any line is too long) and #3156 (Fail to format match arm when other arm has long line). Format it with a large line width (e.g., by setting `max_width = 200` in rustfmt.toml) and, in case the rustfmt bugs are later fixed, mark it with `#[rustfmt::skip]`, as it is more legible with each case on one line.
1 parent 820bfff commit 24f7868

File tree

2 files changed

+35
-97
lines changed

2 files changed

+35
-97
lines changed

Diff for: config.example.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@
323323
#full-bootstrap = false
324324

325325
# Set the bootstrap/download cache path. It is useful when building rust
326-
# repeatedly in a CI invironment.
326+
# repeatedly in a CI environment.
327327
#bootstrap-cache-path = /path/to/shared/cache
328328

329329
# Enable a build of the extended Rust tool set which is not only the compiler

Diff for: library/std/src/sys/pal/uefi/os.rs

+34-96
Original file line numberDiff line numberDiff line change
@@ -17,109 +17,47 @@ 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+
#[rustfmt::skip]
2021
match r_efi::efi::Status::from_usize(errno) {
2122
Status::ABORTED => "The operation was aborted.".to_owned(),
2223
Status::ACCESS_DENIED => "Access was denied.".to_owned(),
2324
Status::ALREADY_STARTED => "The protocol has already been started.".to_owned(),
2425
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-
}
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.".to_owned(),
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.".to_owned(),
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.".to_owned(),
29+
Status::CONNECTION_REFUSED => "The receiving or transmission operation fails because this connection is refused.".to_owned(),
30+
Status::CONNECTION_RESET => "The connect fails because the connection is reset either by instance itself or the communication peer.".to_owned(),
4031
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-
}
32+
Status::DEVICE_ERROR => "The physical device reported an error while attempting the operation.".to_owned(),
33+
Status::END_OF_FILE => "The end of the file was reached.".to_owned(),
34+
Status::END_OF_MEDIA => "Beginning or end of media was reached".to_owned(),
35+
Status::HOST_UNREACHABLE => "The remote host is not reachable.".to_owned(),
36+
Status::HTTP_ERROR => "A HTTP error occurred during the network operation.".to_owned(),
37+
Status::ICMP_ERROR => "An ICMP error occurred during the network operation.".to_owned(),
38+
Status::INCOMPATIBLE_VERSION => "The function encountered an internal version that was incompatible with a version requested by the caller.".to_owned(),
39+
Status::INVALID_LANGUAGE => "The language specified was invalid.".to_owned(),
40+
Status::INVALID_PARAMETER => "A parameter was incorrect.".to_owned(),
41+
Status::IP_ADDRESS_CONFLICT => "There is an address conflict address allocation".to_owned(),
42+
Status::LOAD_ERROR => "The image failed to load.".to_owned(),
43+
Status::MEDIA_CHANGED => "The medium in the device has changed since the last access.".to_owned(),
44+
Status::NETWORK_UNREACHABLE => "The network containing the remote host is not reachable.".to_owned(),
45+
Status::NO_MAPPING => "A mapping to a device does not exist.".to_owned(),
46+
Status::NO_MEDIA => "The device does not contain any medium to perform the operation.".to_owned(),
47+
Status::NO_RESPONSE => "The server was not found or did not respond to the request.".to_owned(),
8848
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-
}
49+
Status::NOT_READY => "There is no data pending upon return.".to_owned(),
50+
Status::NOT_STARTED => "The protocol has not been started.".to_owned(),
51+
Status::OUT_OF_RESOURCES => "A resource has run out.".to_owned(),
52+
Status::PROTOCOL_ERROR => "A protocol error occurred during the network operation.".to_owned(),
53+
Status::PROTOCOL_UNREACHABLE => "An ICMP protocol unreachable error is received.".to_owned(),
54+
Status::SECURITY_VIOLATION => "The function was not performed due to a security violation.".to_owned(),
55+
Status::TFTP_ERROR => "A TFTP error occurred during the network operation.".to_owned(),
11056
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-
}
57+
Status::UNSUPPORTED => "The operation is not supported.".to_owned(),
58+
Status::VOLUME_FULL => "There is no more space on the file system.".to_owned(),
59+
Status::VOLUME_CORRUPTED => "An inconstancy was detected on the file system causing the operating to fail.".to_owned(),
60+
Status::WRITE_PROTECTED => "The device cannot be written to.".to_owned(),
12361
_ => format!("Status: {}", errno),
12462
}
12563
}
@@ -314,7 +252,7 @@ mod uefi_env {
314252

315253
let mut start = 0;
316254

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

0 commit comments

Comments
 (0)