diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-02-29 02:16:21 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-29 02:16:21 +0100 |
| commit | c8db7dcc1cd91366dda9bea92e38b5d215ede1f1 (patch) | |
| tree | 30b13312973df647f11481151c9fc7bea077479a /src/librustc_builtin_macros | |
| parent | ba2df27525ab535aa600cd25fda4aa7f0f13a2aa (diff) | |
| parent | 1622b6ef7372c40381914facf8794d851fcd9eb1 (diff) | |
| download | rust-c8db7dcc1cd91366dda9bea92e38b5d215ede1f1.tar.gz rust-c8db7dcc1cd91366dda9bea92e38b5d215ede1f1.zip | |
Rollup merge of #69551 - matthiaskrgr:len_zero, r=Mark-Simulacrum
use is_empty() instead of len() == x to determine if structs are empty.
Diffstat (limited to 'src/librustc_builtin_macros')
| -rw-r--r-- | src/librustc_builtin_macros/concat.rs | 2 | ||||
| -rw-r--r-- | src/librustc_builtin_macros/format.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/librustc_builtin_macros/concat.rs b/src/librustc_builtin_macros/concat.rs index ed65611da61..1f1c8b8d21e 100644 --- a/src/librustc_builtin_macros/concat.rs +++ b/src/librustc_builtin_macros/concat.rs @@ -49,7 +49,7 @@ pub fn expand_concat( } } } - if missing_literal.len() > 0 { + if !missing_literal.is_empty() { let mut err = cx.struct_span_err(missing_literal, "expected a literal"); err.note("only literals (like `\"foo\"`, `42` and `3.14`) can be passed to `concat!()`"); err.emit(); diff --git a/src/librustc_builtin_macros/format.rs b/src/librustc_builtin_macros/format.rs index ad47e09aa67..0684662b2bf 100644 --- a/src/librustc_builtin_macros/format.rs +++ b/src/librustc_builtin_macros/format.rs @@ -1096,7 +1096,7 @@ pub fn expand_preparsed_format_args( cx.str_pieces.push(s); } - if cx.invalid_refs.len() >= 1 { + if !cx.invalid_refs.is_empty() { cx.report_invalid_references(numbered_position_args); } |
