diff options
| author | klensy <klensy@users.noreply.github.com> | 2021-09-01 15:52:29 +0300 |
|---|---|---|
| committer | klensy <klensy@users.noreply.github.com> | 2021-09-01 15:52:29 +0300 |
| commit | f5f489b945f2fe67474a1a49c5b19cffebc2e7bb (patch) | |
| tree | 6b7e4268d747003ae5dcf5fdf0cf7433c0d5e5d9 | |
| parent | 6c9e708f4be04a5da9267171602be135789b12b8 (diff) | |
| download | rust-f5f489b945f2fe67474a1a49c5b19cffebc2e7bb.tar.gz rust-f5f489b945f2fe67474a1a49c5b19cffebc2e7bb.zip | |
fix clippy lints
| -rw-r--r-- | library/core/src/fmt/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs index 18539fc9588..aff789f2afa 100644 --- a/library/core/src/fmt/mod.rs +++ b/library/core/src/fmt/mod.rs @@ -402,7 +402,7 @@ impl<'a> Arguments<'a> { if self.args.is_empty() { pieces_length - } else if self.pieces[0] == "" && pieces_length < 16 { + } else if !self.pieces.is_empty() && self.pieces[0].is_empty() && pieces_length < 16 { // If the format string starts with an argument, // don't preallocate anything, unless length // of pieces is significant. @@ -1163,7 +1163,7 @@ pub fn write(output: &mut dyn Write, args: Arguments<'_>) -> Result { } // SAFETY: arg and args.args come from the same Arguments, // which guarantees the indexes are always within bounds. - unsafe { run(&mut formatter, arg, &args.args) }?; + unsafe { run(&mut formatter, arg, args.args) }?; idx += 1; } } @@ -1409,7 +1409,7 @@ impl<'a> Formatter<'a> { // we know that it can't panic. Use `get` + `unwrap_or` to avoid // `unsafe` and otherwise don't emit any panic-related code // here. - s.get(..i).unwrap_or(&s) + s.get(..i).unwrap_or(s) } else { &s } |
