Skip to content

Commit

Permalink
Rollup merge of rust-lang#125730 - mu001999-contrib:clippy-fix, r=oli…
Browse files Browse the repository at this point in the history
…-obk

Apply `x clippy --fix` and `x fmt` on Rustc

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->

Just run `x clippy --fix` and `x fmt`, and remove some changes like `impl Default`.
  • Loading branch information
matthiaskrgr authored May 31, 2024
2 parents 9fe1803 + 6f01ba7 commit 5c2e274
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion proc_macro/src/bridge/fxhash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl Hasher for FxHasher {
hash.add_to_hash(u16::from_ne_bytes(bytes[..2].try_into().unwrap()) as usize);
bytes = &bytes[2..];
}
if (size_of::<usize>() > 1) && bytes.len() >= 1 {
if (size_of::<usize>() > 1) && !bytes.is_empty() {
hash.add_to_hash(bytes[0] as usize);
}
self.hash = hash.hash;
Expand Down
6 changes: 3 additions & 3 deletions proc_macro/src/bridge/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ impl From<Box<dyn Any + Send>> for PanicMessage {
}
}

impl Into<Box<dyn Any + Send>> for PanicMessage {
fn into(self) -> Box<dyn Any + Send> {
match self {
impl From<PanicMessage> for Box<dyn Any + Send> {
fn from(val: PanicMessage) -> Self {
match val {
PanicMessage::StaticStr(s) => Box::new(s),
PanicMessage::String(s) => Box::new(s),
PanicMessage::Unknown => {
Expand Down
2 changes: 1 addition & 1 deletion test/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ Test Attributes:
pub fn parse_opts(args: &[String]) -> Option<OptRes> {
// Parse matches.
let opts = optgroups();
let binary = args.get(0).map(|c| &**c).unwrap_or("...");
let binary = args.first().map(|c| &**c).unwrap_or("...");
let args = args.get(1..).unwrap_or(args);
let matches = match opts.parse(args) {
Ok(m) => m,
Expand Down
2 changes: 1 addition & 1 deletion test/src/term/terminfo/parm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result<Vec<u8>, String> {
} else {
let mut s_ = Vec::with_capacity(flags.width);
s_.extend(repeat(b' ').take(n));
s_.extend(s.into_iter());
s_.extend(s);
s = s_;
}
}
Expand Down

0 comments on commit 5c2e274

Please sign in to comment.