Apply x clippy --fix and x fmt · model-checking/verify-rust-std@6f01ba7 (original) (raw)

4 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -69,7 +69,7 @@ impl Hasher for FxHasher {
69 69 hash.add_to_hash(u16::from_ne_bytes(bytes[..2].try_into().unwrap()) as usize);
70 70 bytes = &bytes[2..];
71 71 }
72 -if (size_of::<usize>() > 1) && bytes.len() >= 1 {
72 +if (size_of::<usize>() > 1) && !bytes.is_empty() {
73 73 hash.add_to_hash(bytes[0] as usize);
74 74 }
75 75 self.hash = hash.hash;
Original file line number Diff line number Diff line change
@@ -264,9 +264,9 @@ impl From<Box<dyn Any + Send>> for PanicMessage {
264 264 }
265 265 }
266 266
267 -impl Into<Box<dyn Any + Send>> for PanicMessage {
268 -fn into(self) -> Box<dyn Any + Send> {
269 -match self {
267 +impl From<PanicMessage> for Box<dyn Any + Send> {
268 +fn from(val: PanicMessage) -> Self {
269 +match val {
270 270 PanicMessage::StaticStr(s) => Box::new(s),
271 271 PanicMessage::String(s) => Box::new(s),
272 272 PanicMessage::Unknown => {
Original file line number Diff line number Diff line change
@@ -200,7 +200,7 @@ Test Attributes:
200 200 pub fn parse_opts(args: &[String]) -> Option<OptRes> {
201 201 // Parse matches.
202 202 let opts = optgroups();
203 -let binary = args.get(0).map(|c
203 +let binary = args.first().map(|c
204 204 let args = args.get(1..).unwrap_or(args);
205 205 let matches = match opts.parse(args) {
206 206 Ok(m) => m,
Original file line number Diff line number Diff line change
@@ -524,7 +524,7 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result<Vec, String> {
524 524 } else {
525 525 let mut s_ = Vec::with_capacity(flags.width);
526 526 s_.extend(repeat(b' ').take(n));
527 - s_.extend(s.into_iter());
527 + s_.extend(s);
528 528 s = s_;
529 529 }
530 530 }