about summary refs log tree commit diff
diff options
context:
space:
mode:
authorljedrz <ljedrz@gmail.com>2018-09-28 17:28:47 +0200
committerljedrz <ljedrz@gmail.com>2018-09-29 14:57:40 +0200
commit0e84647e18181ea9aa199d42b3da598eb59ab70c (patch)
tree6a7be0e53aba5503f78f0e0020657971b93d1231
parent9fd6fad3208c5f3ad11c49b65eb89732ad911e81 (diff)
downloadrust-0e84647e18181ea9aa199d42b3da598eb59ab70c.tar.gz
rust-0e84647e18181ea9aa199d42b3da598eb59ab70c.zip
rustc/infer: use to_owned instead of to_string with string literals
-rw-r--r--src/librustc/infer/error_reporting/need_type_info.rs8
-rw-r--r--src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs10
-rw-r--r--src/librustc/infer/lexical_region_resolve/graphviz.rs2
3 files changed, 10 insertions, 10 deletions
diff --git a/src/librustc/infer/error_reporting/need_type_info.rs b/src/librustc/infer/error_reporting/need_type_info.rs
index 505b1bc032d..efb316243fa 100644
--- a/src/librustc/infer/error_reporting/need_type_info.rs
+++ b/src/librustc/infer/error_reporting/need_type_info.rs
@@ -100,7 +100,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
         let mut labels = vec![(
             span,
             if &name == "_" {
-                "cannot infer type".to_string()
+                "cannot infer type".to_owned()
             } else {
                 format!("cannot infer type for `{}`", name)
             },
@@ -138,7 +138,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
             // ```
             labels.clear();
             labels.push(
-                (pattern.span, "consider giving this closure parameter a type".to_string()));
+                (pattern.span, "consider giving this closure parameter a type".to_owned()));
         } else if let Some(pattern) = local_visitor.found_local_pattern {
             if let Some(simple_ident) = pattern.simple_ident() {
                 match pattern.span.compiler_desugaring_kind() {
@@ -146,12 +146,12 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
                                          format!("consider giving `{}` a type", simple_ident))),
                     Some(CompilerDesugaringKind::ForLoop) => labels.push((
                         pattern.span,
-                        "the element type for this iterator is not specified".to_string(),
+                        "the element type for this iterator is not specified".to_owned(),
                     )),
                     _ => {}
                 }
             } else {
-                labels.push((pattern.span, "consider giving the pattern a type".to_string()));
+                labels.push((pattern.span, "consider giving the pattern a type".to_owned()));
             }
         }
 
diff --git a/src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs b/src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs
index 97b1978cb2e..1f84c73a715 100644
--- a/src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs
+++ b/src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs
@@ -113,12 +113,12 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
             (None, None) => {
                 let (main_label_1, span_label_1) = if ty_sup.id == ty_sub.id {
                     (
-                        "this type is declared with multiple lifetimes...".to_string(),
-                        "...but data with one lifetime flows into the other here".to_string()
+                        "this type is declared with multiple lifetimes...".to_owned(),
+                        "...but data with one lifetime flows into the other here".to_owned()
                     )
                 } else {
                     (
-                        "these two types are declared with different lifetimes...".to_string(),
+                        "these two types are declared with different lifetimes...".to_owned(),
                         format!(
                             "...but data{} flows{} here",
                             span_label_var1,
@@ -133,7 +133,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
                 ty_sub.span,
                 ret_span,
                 "this parameter and the return type are declared \
-                 with different lifetimes...".to_string()
+                 with different lifetimes...".to_owned()
                 ,
                 format!("...but data{} is returned here", span_label_var1),
             ),
@@ -141,7 +141,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
                 ty_sup.span,
                 ret_span,
                 "this parameter and the return type are declared \
-                 with different lifetimes...".to_string()
+                 with different lifetimes...".to_owned()
                 ,
                 format!("...but data{} is returned here", span_label_var1),
             ),
diff --git a/src/librustc/infer/lexical_region_resolve/graphviz.rs b/src/librustc/infer/lexical_region_resolve/graphviz.rs
index e4705df2eea..48ec3210fe7 100644
--- a/src/librustc/infer/lexical_region_resolve/graphviz.rs
+++ b/src/librustc/infer/lexical_region_resolve/graphviz.rs
@@ -198,7 +198,7 @@ impl<'a, 'gcx, 'tcx> dot::Labeller<'a> for ConstraintGraph<'a, 'gcx, 'tcx> {
         match *e {
             Edge::Constraint(ref c) =>
                 dot::LabelText::label(format!("{:?}", self.map.get(c).unwrap())),
-            Edge::EnclScope(..) => dot::LabelText::label("(enclosed)".to_string()),
+            Edge::EnclScope(..) => dot::LabelText::label("(enclosed)".to_owned()),
         }
     }
 }