diff options
| author | bors <bors@rust-lang.org> | 2020-02-29 10:43:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-02-29 10:43:32 +0000 |
| commit | 3f9bddc7fea3ca1d49f39f22bb937a84ed32f84e (patch) | |
| tree | f832b09e3ffce6a55b209ef234a99c06742d18eb /src/librustc_errors | |
| parent | 04e7f96dd89b1f0ad615dff1c85d11d4c4c64cb4 (diff) | |
| parent | bbfec7ca41887af04abb4510677c4539a95f03a2 (diff) | |
| download | rust-3f9bddc7fea3ca1d49f39f22bb937a84ed32f84e.tar.gz rust-3f9bddc7fea3ca1d49f39f22bb937a84ed32f84e.zip | |
Auto merge of #69570 - Dylan-DPC:rollup-d6boczt, r=Dylan-DPC
Rollup of 6 pull requests Successful merges: - #69477 (docs: add mention of async blocks in move keyword docs) - #69504 (Use assert_ne in hash tests) - #69546 (use to_vec() instead of .iter().cloned().collect() to convert slices to vecs.) - #69551 (use is_empty() instead of len() == x to determine if structs are empty.) - #69563 (Fix no_std detection for target triples) - #69567 (use .to_string() instead of format!() macro to create strings) Failed merges: r? @ghost
Diffstat (limited to 'src/librustc_errors')
| -rw-r--r-- | src/librustc_errors/diagnostic.rs | 6 | ||||
| -rw-r--r-- | src/librustc_errors/emitter.rs | 2 | ||||
| -rw-r--r-- | src/librustc_errors/snippet.rs | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/librustc_errors/diagnostic.rs b/src/librustc_errors/diagnostic.rs index 189b5bd0f9e..1cc5daafed1 100644 --- a/src/librustc_errors/diagnostic.rs +++ b/src/librustc_errors/diagnostic.rs @@ -167,17 +167,17 @@ impl Diagnostic { found: DiagnosticStyledString, ) -> &mut Self { let mut msg: Vec<_> = - vec![(format!("required when trying to coerce from type `"), Style::NoStyle)]; + vec![("required when trying to coerce from type `".to_string(), Style::NoStyle)]; msg.extend(expected.0.iter().map(|x| match *x { StringPart::Normal(ref s) => (s.to_owned(), Style::NoStyle), StringPart::Highlighted(ref s) => (s.to_owned(), Style::Highlight), })); - msg.push((format!("` to type '"), Style::NoStyle)); + msg.push(("` to type '".to_string(), Style::NoStyle)); msg.extend(found.0.iter().map(|x| match *x { StringPart::Normal(ref s) => (s.to_owned(), Style::NoStyle), StringPart::Highlighted(ref s) => (s.to_owned(), Style::Highlight), })); - msg.push((format!("`"), Style::NoStyle)); + msg.push(("`".to_string(), Style::NoStyle)); // For now, just attach these as notes self.highlighted_note(msg); diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index f3653da4be6..2d7ff191c77 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -231,7 +231,7 @@ pub trait Emitter { ].contains(&sugg.style) { let substitution = &sugg.substitutions[0].parts[0].snippet.trim(); - let msg = if substitution.len() == 0 || sugg.style.hide_inline() { + let msg = if substitution.is_empty() || sugg.style.hide_inline() { // This substitution is only removal OR we explicitly don't want to show the // code inline (`hide_inline`). Therefore, we don't show the substitution. format!("help: {}", sugg.msg) diff --git a/src/librustc_errors/snippet.rs b/src/librustc_errors/snippet.rs index a39e19f0bf7..0660590a725 100644 --- a/src/librustc_errors/snippet.rs +++ b/src/librustc_errors/snippet.rs @@ -152,7 +152,7 @@ impl Annotation { // | // // Note that this would be the complete output users would see. - label.len() > 0 + !label.is_empty() } else { false } |
