Rollup merge of #53563 - matthiaskrgr:String, r=varkor

use String::new() instead of String::from(""), "".to_string(), "".to_owned() or "".into()
This commit is contained in:
kennytm 2018-08-24 16:44:35 +08:00 committed by GitHub
commit d13c61208a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
87 changed files with 133 additions and 133 deletions

View file

@ -1330,7 +1330,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
s s
}; };
let var_description = match var_origin { let var_description = match var_origin {
infer::MiscVariable(_) => "".to_string(), infer::MiscVariable(_) => String::new(),
infer::PatternRegion(_) => " for pattern".to_string(), infer::PatternRegion(_) => " for pattern".to_string(),
infer::AddrOfRegion(_) => " for borrow expression".to_string(), infer::AddrOfRegion(_) => " for borrow expression".to_string(),
infer::Autoref(_) => " for autoref".to_string(), infer::Autoref(_) => " for autoref".to_string(),

View file

@ -2105,7 +2105,7 @@ impl<'tcx> Debug for Rvalue<'tcx> {
region region
} else { } else {
// Do not even print 'static // Do not even print 'static
"".to_owned() String::new()
}; };
write!(fmt, "&{}{}{:?}", region, kind_str, place) write!(fmt, "&{}{}{:?}", region, kind_str, place)
} }

View file

@ -1051,7 +1051,7 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
"perform LLVM link-time optimizations"), "perform LLVM link-time optimizations"),
target_cpu: Option<String> = (None, parse_opt_string, [TRACKED], target_cpu: Option<String> = (None, parse_opt_string, [TRACKED],
"select target processor (rustc --print target-cpus for details)"), "select target processor (rustc --print target-cpus for details)"),
target_feature: String = ("".to_string(), parse_string, [TRACKED], target_feature: String = (String::new(), parse_string, [TRACKED],
"target specific attributes (rustc --print target-features for details)"), "target specific attributes (rustc --print target-features for details)"),
passes: Vec<String> = (Vec::new(), parse_list, [TRACKED], passes: Vec<String> = (Vec::new(), parse_list, [TRACKED],
"a list of extra LLVM passes to run (space separated)"), "a list of extra LLVM passes to run (space separated)"),
@ -1085,7 +1085,7 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
"choose the code model to use (rustc --print code-models for details)"), "choose the code model to use (rustc --print code-models for details)"),
metadata: Vec<String> = (Vec::new(), parse_list, [TRACKED], metadata: Vec<String> = (Vec::new(), parse_list, [TRACKED],
"metadata to mangle symbol names with"), "metadata to mangle symbol names with"),
extra_filename: String = ("".to_string(), parse_string, [UNTRACKED], extra_filename: String = (String::new(), parse_string, [UNTRACKED],
"extra data to put in each output filename"), "extra data to put in each output filename"),
codegen_units: Option<usize> = (None, parse_opt_uint, [UNTRACKED], codegen_units: Option<usize> = (None, parse_opt_uint, [UNTRACKED],
"divide crate into N units to optimize in parallel"), "divide crate into N units to optimize in parallel"),
@ -1992,7 +1992,7 @@ pub fn build_session_options_and_crate_config(
}; };
if cg.target_feature == "help" { if cg.target_feature == "help" {
prints.push(PrintRequest::TargetFeatures); prints.push(PrintRequest::TargetFeatures);
cg.target_feature = "".to_string(); cg.target_feature = String::new();
} }
if cg.relocation_model.as_ref().map_or(false, |s| s == "help") { if cg.relocation_model.as_ref().map_or(false, |s| s == "help") {
prints.push(PrintRequest::RelocationModels); prints.push(PrintRequest::RelocationModels);

View file

@ -472,7 +472,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
if len > 5 { if len > 5 {
format!("\nand {} others", len - 4) format!("\nand {} others", len - 4)
} else { } else {
"".to_owned() String::new()
} }
)); ));
} }
@ -917,7 +917,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
remove_refs); remove_refs);
err.span_suggestion_short_with_applicability( err.span_suggestion_short_with_applicability(
sp, &format_str, String::from(""), Applicability::MachineApplicable sp, &format_str, String::new(), Applicability::MachineApplicable
); );
break; break;
} }
@ -1116,7 +1116,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
.collect::<Vec<String>>() .collect::<Vec<String>>()
.join(", ")) .join(", "))
} else { } else {
"".to_owned() String::new()
}, },
); );
err.span_suggestion_with_applicability( err.span_suggestion_with_applicability(

View file

@ -120,13 +120,13 @@ impl IntercrateAmbiguityCause {
&IntercrateAmbiguityCause::DownstreamCrate { ref trait_desc, ref self_desc } => { &IntercrateAmbiguityCause::DownstreamCrate { ref trait_desc, ref self_desc } => {
let self_desc = if let &Some(ref ty) = self_desc { let self_desc = if let &Some(ref ty) = self_desc {
format!(" for type `{}`", ty) format!(" for type `{}`", ty)
} else { "".to_string() }; } else { String::new() };
format!("downstream crates may implement trait `{}`{}", trait_desc, self_desc) format!("downstream crates may implement trait `{}`{}", trait_desc, self_desc)
} }
&IntercrateAmbiguityCause::UpstreamCrateUpdate { ref trait_desc, ref self_desc } => { &IntercrateAmbiguityCause::UpstreamCrateUpdate { ref trait_desc, ref self_desc } => {
let self_desc = if let &Some(ref ty) = self_desc { let self_desc = if let &Some(ref ty) = self_desc {
format!(" for type `{}`", ty) format!(" for type `{}`", ty)
} else { "".to_string() }; } else { String::new() };
format!("upstream crates may add new impl of trait `{}`{} \ format!("upstream crates may add new impl of trait `{}`{} \
in future versions", in future versions",
trait_desc, self_desc) trait_desc, self_desc)

View file

@ -213,7 +213,7 @@ fn print_time_passes_entry_internal(what: &str, dur: Duration) {
let mb = n as f64 / 1_000_000.0; let mb = n as f64 / 1_000_000.0;
format!("; rss: {}MB", mb.round() as usize) format!("; rss: {}MB", mb.round() as usize)
} }
None => "".to_owned(), None => String::new(),
}; };
println!("{}time: {}{}\t{}", println!("{}time: {}{}\t{}",
" ".repeat(indentation), " ".repeat(indentation),

View file

@ -73,7 +73,7 @@ macro_rules! define_categories {
(format!("{:.2}", (format!("{:.2}",
(((hits as f32) / (total as f32)) * 100.0)), total.to_string()) (((hits as f32) / (total as f32)) * 100.0)), total.to_string())
} else { } else {
("".into(), "".into()) (String::new(), String::new())
}; };
writeln!( writeln!(

View file

@ -87,7 +87,7 @@ impl<'a, 'tcx> UnusedMutCx<'a, 'tcx> {
.span_suggestion_short_with_applicability( .span_suggestion_short_with_applicability(
mut_span, mut_span,
"remove this `mut`", "remove this `mut`",
"".to_owned(), String::new(),
Applicability::MachineApplicable) Applicability::MachineApplicable)
.emit(); .emit();
} }

View file

@ -140,21 +140,21 @@ impl<'a, 'tcx, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'a, 'tcx, O
let gens_str = if gens.iter().any(|&u| u != 0) { let gens_str = if gens.iter().any(|&u| u != 0) {
format!(" gen: {}", bits_to_string(gens)) format!(" gen: {}", bits_to_string(gens))
} else { } else {
"".to_string() String::new()
}; };
let action_kills = &self.action_kills[start .. end]; let action_kills = &self.action_kills[start .. end];
let action_kills_str = if action_kills.iter().any(|&u| u != 0) { let action_kills_str = if action_kills.iter().any(|&u| u != 0) {
format!(" action_kill: {}", bits_to_string(action_kills)) format!(" action_kill: {}", bits_to_string(action_kills))
} else { } else {
"".to_string() String::new()
}; };
let scope_kills = &self.scope_kills[start .. end]; let scope_kills = &self.scope_kills[start .. end];
let scope_kills_str = if scope_kills.iter().any(|&u| u != 0) { let scope_kills_str = if scope_kills.iter().any(|&u| u != 0) {
format!(" scope_kill: {}", bits_to_string(scope_kills)) format!(" scope_kill: {}", bits_to_string(scope_kills))
} else { } else {
"".to_string() String::new()
}; };
ps.synth_comment( ps.synth_comment(

View file

@ -53,7 +53,7 @@ impl<'a, 'tcx> DataflowLabeller<'a, 'tcx> {
fn dataflow_for(&self, e: EntryOrExit, n: &Node<'a>) -> String { fn dataflow_for(&self, e: EntryOrExit, n: &Node<'a>) -> String {
let id = n.1.data.id(); let id = n.1.data.id();
debug!("dataflow_for({:?}, id={:?}) {:?}", e, id, self.variants); debug!("dataflow_for({:?}, id={:?}) {:?}", e, id, self.variants);
let mut sets = "".to_string(); let mut sets = String::new();
let mut seen_one = false; let mut seen_one = false;
for &variant in &self.variants { for &variant in &self.variants {
if seen_one { sets.push_str(" "); } else { seen_one = true; } if seen_one { sets.push_str(" "); } else { seen_one = true; }

View file

@ -1191,7 +1191,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> {
member_descriptions); member_descriptions);
vec![ vec![
MemberDescription { MemberDescription {
name: "".to_string(), name: String::new(),
type_metadata: variant_type_metadata, type_metadata: variant_type_metadata,
offset: Size::ZERO, offset: Size::ZERO,
size: self.layout.size, size: self.layout.size,
@ -1220,7 +1220,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> {
variant_type_metadata, variant_type_metadata,
member_descriptions); member_descriptions);
MemberDescription { MemberDescription {
name: "".to_string(), name: String::new(),
type_metadata: variant_type_metadata, type_metadata: variant_type_metadata,
offset: Size::ZERO, offset: Size::ZERO,
size: variant.size, size: variant.size,

View file

@ -85,7 +85,7 @@ pub fn html_of_effect(eff: &Effect) -> (String, String) {
fn html_of_duration(_start: &Instant, dur: &Duration) -> (String, String) { fn html_of_duration(_start: &Instant, dur: &Duration) -> (String, String) {
use rustc::util::common::duration_to_secs_str; use rustc::util::common::duration_to_secs_str;
(duration_to_secs_str(dur.clone()), (duration_to_secs_str(dur.clone()),
"".to_string() String::new()
) )
} }

View file

@ -798,7 +798,7 @@ impl EmitterWriter {
// at by "in this macro invocation" // at by "in this macro invocation"
format!(" (#{})", i + 1) format!(" (#{})", i + 1)
} else { } else {
"".to_string() String::new()
}))); })));
} }
// Check to make sure we're not in any <*macros> // Check to make sure we're not in any <*macros>
@ -813,7 +813,7 @@ impl EmitterWriter {
// backtrace is multiple levels deep // backtrace is multiple levels deep
format!(" (#{})", i + 1) format!(" (#{})", i + 1)
} else { } else {
"".to_string() String::new()
}))); })));
if !always_backtrace { if !always_backtrace {
break; break;
@ -1065,7 +1065,7 @@ impl EmitterWriter {
let col = if let Some(first_annotation) = first_line.annotations.first() { let col = if let Some(first_annotation) = first_line.annotations.first() {
format!(":{}", first_annotation.start_col + 1) format!(":{}", first_annotation.start_col + 1)
} else { } else {
"".to_string() String::new()
}; };
format!("{}:{}{}", format!("{}:{}{}",
annotated_file.file.name, annotated_file.file.name,

View file

@ -795,7 +795,7 @@ impl EarlyLintPass for DeprecatedAttr {
err.span_suggestion_short_with_applicability( err.span_suggestion_short_with_applicability(
attr.span, attr.span,
"remove this attribute", "remove this attribute",
"".to_owned(), String::new(),
Applicability::MachineApplicable Applicability::MachineApplicable
); );
err.emit(); err.emit();
@ -1251,7 +1251,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidNoMangleItems {
err.span_suggestion_short_with_applicability( err.span_suggestion_short_with_applicability(
no_mangle_attr.span, no_mangle_attr.span,
"remove this attribute", "remove this attribute",
"".to_owned(), String::new(),
// Use of `#[no_mangle]` suggests FFI intent; correct // Use of `#[no_mangle]` suggests FFI intent; correct
// fix may be to monomorphize source by hand // fix may be to monomorphize source by hand
Applicability::MaybeIncorrect Applicability::MaybeIncorrect

View file

@ -327,7 +327,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
err.span_suggestion_short_with_applicability( err.span_suggestion_short_with_applicability(
mut_span, mut_span,
"remove this `mut`", "remove this `mut`",
"".to_owned(), String::new(),
Applicability::MachineApplicable); Applicability::MachineApplicable);
err.buffer(&mut mbcx.errors_buffer); err.buffer(&mut mbcx.errors_buffer);

View file

@ -128,7 +128,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> {
} }
} else { } else {
item_msg = format!("data in a {}", pointer_type); item_msg = format!("data in a {}", pointer_type);
reason = "".to_string(); reason = String::new();
} }
} }
} }
@ -138,7 +138,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> {
Place::Static(box Static { def_id, ty: _ }) => { Place::Static(box Static { def_id, ty: _ }) => {
if let Place::Static(_) = access_place { if let Place::Static(_) = access_place {
item_msg = format!("immutable static item `{}`", access_place_desc.unwrap()); item_msg = format!("immutable static item `{}`", access_place_desc.unwrap());
reason = "".to_string(); reason = String::new();
} else { } else {
item_msg = format!("`{}`", access_place_desc.unwrap()); item_msg = format!("`{}`", access_place_desc.unwrap());
let static_name = &self.tcx.item_name(*def_id); let static_name = &self.tcx.item_name(*def_id);

View file

@ -474,7 +474,7 @@ pub trait BorrowckErrors<'cx>: Sized + Copy {
) -> DiagnosticBuilder<'cx> { ) -> DiagnosticBuilder<'cx> {
let moved_path = moved_path let moved_path = moved_path
.map(|mp| format!(": `{}`", mp)) .map(|mp| format!(": `{}`", mp))
.unwrap_or("".to_owned()); .unwrap_or(String::new());
let err = struct_span_err!( let err = struct_span_err!(
self, self,

View file

@ -994,7 +994,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
let lev_suggestion = let lev_suggestion =
match find_best_match_for_name(names, &ident.as_str(), None) { match find_best_match_for_name(names, &ident.as_str(), None) {
Some(name) => format!(". Did you mean to use `{}`?", name), Some(name) => format!(". Did you mean to use `{}`?", name),
None => "".to_owned(), None => String::new(),
}; };
let msg = match module { let msg = match module {
ModuleOrUniformRoot::Module(module) => { ModuleOrUniformRoot::Module(module) => {

View file

@ -1050,7 +1050,7 @@ impl<'a> DumpHandler<'a> {
.iter() .iter()
.any(|ct| *ct == CrateType::Executable); .any(|ct| *ct == CrateType::Executable);
let mut out_name = if executable { let mut out_name = if executable {
"".to_owned() String::new()
} else { } else {
"lib".to_owned() "lib".to_owned()
}; };

View file

@ -21,7 +21,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".to_string(), data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(), arch: "aarch64".to_string(),
target_os: "ios".to_string(), target_os: "ios".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "apple".to_string(), target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {

View file

@ -22,8 +22,8 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(), arch: "aarch64".to_string(),
target_os: "fuchsia".to_string(), target_os: "fuchsia".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "".to_string(), target_vendor: String::new(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
abi_blacklist: super::arm_base::abi_blacklist(), abi_blacklist: super::arm_base::abi_blacklist(),

View file

@ -27,7 +27,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(), arch: "aarch64".to_string(),
target_os: "android".to_string(), target_os: "android".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {

View file

@ -24,7 +24,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(), arch: "aarch64".to_string(),
target_os: "cloudabi".to_string(), target_os: "cloudabi".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(), arch: "aarch64".to_string(),
target_os: "freebsd".to_string(), target_os: "freebsd".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {

View file

@ -24,7 +24,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(), arch: "aarch64".to_string(),
target_os: "hermit".to_string(), target_os: "hermit".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -23,7 +23,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(), arch: "aarch64".to_string(),
target_os: "netbsd".to_string(), target_os: "netbsd".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -36,8 +36,8 @@ pub fn target() -> Result<Target, String> {
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
target_c_int_width: "32".to_string(), target_c_int_width: "32".to_string(),
target_os: "none".to_string(), target_os: "none".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "".to_string(), target_vendor: String::new(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(), arch: "aarch64".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),

View file

@ -23,7 +23,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(), arch: "aarch64".to_string(),
target_os: "openbsd".to_string(), target_os: "openbsd".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -24,7 +24,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "android".to_string(), target_os: "android".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {

View file

@ -22,8 +22,8 @@ pub fn target() -> TargetResult {
data_layout: "E-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "E-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "none".to_string(), target_os: "none".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "".to_string(), target_vendor: String::new(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {

View file

@ -21,7 +21,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_string(), data_layout: "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "ios".to_string(), target_os: "ios".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "apple".to_string(), target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {

View file

@ -28,7 +28,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "android".to_string(), target_os: "android".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {

View file

@ -26,7 +26,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "cloudabi".to_string(), target_os: "cloudabi".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -21,7 +21,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_string(), data_layout: "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "ios".to_string(), target_os: "ios".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "apple".to_string(), target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {

View file

@ -40,7 +40,7 @@ pub fn target() -> Result<Target, String> {
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
target_c_int_width: "32".to_string(), target_c_int_width: "32".to_string(),
target_os: "emscripten".to_string(), target_os: "emscripten".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
data_layout: "e-p:32:32-i64:64-v128:32:128-n32-S128".to_string(), data_layout: "e-p:32:32-i64:64-v128:32:128-n32-S128".to_string(),
arch: "asmjs".to_string(), arch: "asmjs".to_string(),

View file

@ -21,7 +21,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128".to_string(), data_layout: "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128".to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
target_os: "ios".to_string(), target_os: "ios".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "apple".to_string(), target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {

View file

@ -26,7 +26,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128".to_string(), data_layout: "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128".to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
target_os: "macos".to_string(), target_os: "macos".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "apple".to_string(), target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -31,7 +31,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(), data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
target_os: "android".to_string(), target_os: "android".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -26,7 +26,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(), data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
target_os: "cloudabi".to_string(), target_os: "cloudabi".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(), data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
target_os: "dragonfly".to_string(), target_os: "dragonfly".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(), data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
target_os: "freebsd".to_string(), target_os: "freebsd".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(), data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
target_os: "haiku".to_string(), target_os: "haiku".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(), data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
target_os: "netbsd".to_string(), target_os: "netbsd".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -26,7 +26,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(), data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
target_os: "openbsd".to_string(), target_os: "openbsd".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -686,7 +686,7 @@ impl Default for TargetOptions {
post_link_args: LinkArgs::new(), post_link_args: LinkArgs::new(),
asm_args: Vec::new(), asm_args: Vec::new(),
cpu: "generic".to_string(), cpu: "generic".to_string(),
features: "".to_string(), features: String::new(),
dynamic_linking: false, dynamic_linking: false,
only_cdylib: false, only_cdylib: false,
executables: false, executables: false,
@ -698,7 +698,7 @@ impl Default for TargetOptions {
function_sections: true, function_sections: true,
dll_prefix: "lib".to_string(), dll_prefix: "lib".to_string(),
dll_suffix: ".so".to_string(), dll_suffix: ".so".to_string(),
exe_suffix: "".to_string(), exe_suffix: String::new(),
staticlib_prefix: "lib".to_string(), staticlib_prefix: "lib".to_string(),
staticlib_suffix: ".a".to_string(), staticlib_suffix: ".a".to_string(),
target_family: None, target_family: None,

View file

@ -19,8 +19,8 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16".to_string(), data_layout: "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16".to_string(),
arch: "msp430".to_string(), arch: "msp430".to_string(),
target_os: "none".to_string(), target_os: "none".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "".to_string(), target_vendor: String::new(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {

View file

@ -26,7 +26,7 @@ pub fn target() -> TargetResult {
data_layout: "E-m:e-p:32:32-i64:64-n32".to_string(), data_layout: "E-m:e-p:32:32-i64:64-n32".to_string(),
arch: "powerpc".to_string(), arch: "powerpc".to_string(),
target_os: "netbsd".to_string(), target_os: "netbsd".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -19,7 +19,7 @@ pub fn target() -> TargetResult {
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
target_c_int_width: "32".to_string(), target_c_int_width: "32".to_string(),
target_os: "none".to_string(), target_os: "none".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
arch: "riscv32".to_string(), arch: "riscv32".to_string(),
linker_flavor: LinkerFlavor::Ld, linker_flavor: LinkerFlavor::Ld,

View file

@ -24,7 +24,7 @@ pub fn target() -> TargetResult {
data_layout: "E-m:e-i64:64-n32:64-S128".to_string(), data_layout: "E-m:e-i64:64-n32:64-S128".to_string(),
arch: "sparc64".to_string(), arch: "sparc64".to_string(),
target_os: "netbsd".to_string(), target_os: "netbsd".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -30,7 +30,7 @@ pub fn target() -> TargetResult {
// just be confusing. // just be confusing.
arch: "sparc64".to_string(), arch: "sparc64".to_string(),
target_os: "solaris".to_string(), target_os: "solaris".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "sun".to_string(), target_vendor: "sun".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -21,8 +21,8 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "none".to_string(), target_os: "none".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "".to_string(), target_vendor: String::new(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {

View file

@ -30,8 +30,8 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "none".to_string(), target_os: "none".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "".to_string(), target_vendor: String::new(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {

View file

@ -29,8 +29,8 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "none".to_string(), target_os: "none".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "".to_string(), target_vendor: String::new(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {

View file

@ -21,8 +21,8 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "none".to_string(), target_os: "none".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "".to_string(), target_vendor: String::new(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {

View file

@ -43,7 +43,7 @@ pub fn target() -> Result<Target, String> {
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
target_c_int_width: "32".to_string(), target_c_int_width: "32".to_string(),
target_os: "emscripten".to_string(), target_os: "emscripten".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
data_layout: "e-m:e-p:32:32-i64:64-n32:64-S128".to_string(), data_layout: "e-m:e-p:32:32-i64:64-n32:64-S128".to_string(),
arch: "wasm32".to_string(), arch: "wasm32".to_string(),

View file

@ -40,7 +40,7 @@ pub fn target() -> Result<Target, String> {
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
target_c_int_width: "32".to_string(), target_c_int_width: "32".to_string(),
target_os: "emscripten".to_string(), target_os: "emscripten".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
data_layout: "e-p:32:32-i64:64-v128:32:128-n32-S128".to_string(), data_layout: "e-p:32:32-i64:64-v128:32:128-n32-S128".to_string(),
arch: "wasm32".to_string(), arch: "wasm32".to_string(),

View file

@ -32,7 +32,7 @@ pub fn target() -> Result<Target, String> {
// relatively self-explanatory! // relatively self-explanatory!
exe_suffix: ".wasm".to_string(), exe_suffix: ".wasm".to_string(),
dll_prefix: "".to_string(), dll_prefix: String::new(),
dll_suffix: ".wasm".to_string(), dll_suffix: ".wasm".to_string(),
linker_is_gnu: false, linker_is_gnu: false,
@ -65,7 +65,7 @@ pub fn target() -> Result<Target, String> {
// This is basically guaranteed to change in the future, don't rely on // This is basically guaranteed to change in the future, don't rely on
// this. Use `not(target_os = "emscripten")` for now. // this. Use `not(target_os = "emscripten")` for now.
target_os: "unknown".to_string(), target_os: "unknown".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
data_layout: "e-m:e-p:32:32-i64:64-n32:64-S128".to_string(), data_layout: "e-m:e-p:32:32-i64:64-n32:64-S128".to_string(),
arch: "wasm32".to_string(), arch: "wasm32".to_string(),

View file

@ -77,10 +77,10 @@ pub fn opts() -> TargetOptions {
linker: Some("gcc".to_string()), linker: Some("gcc".to_string()),
dynamic_linking: true, dynamic_linking: true,
executables: true, executables: true,
dll_prefix: "".to_string(), dll_prefix: String::new(),
dll_suffix: ".dll".to_string(), dll_suffix: ".dll".to_string(),
exe_suffix: ".exe".to_string(), exe_suffix: ".exe".to_string(),
staticlib_prefix: "".to_string(), staticlib_prefix: String::new(),
staticlib_suffix: ".lib".to_string(), staticlib_suffix: ".lib".to_string(),
no_default_libraries: true, no_default_libraries: true,
target_family: Some("windows".to_string()), target_family: Some("windows".to_string()),

View file

@ -21,10 +21,10 @@ pub fn opts() -> TargetOptions {
function_sections: true, function_sections: true,
dynamic_linking: true, dynamic_linking: true,
executables: true, executables: true,
dll_prefix: "".to_string(), dll_prefix: String::new(),
dll_suffix: ".dll".to_string(), dll_suffix: ".dll".to_string(),
exe_suffix: ".exe".to_string(), exe_suffix: ".exe".to_string(),
staticlib_prefix: "".to_string(), staticlib_prefix: String::new(),
staticlib_suffix: ".lib".to_string(), staticlib_suffix: ".lib".to_string(),
target_family: Some("windows".to_string()), target_family: Some("windows".to_string()),
is_like_windows: true, is_like_windows: true,

View file

@ -26,7 +26,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:o-i64:64-f80:128-n8:16:32:64-S128".to_string(), data_layout: "e-m:o-i64:64-f80:128-n8:16:32:64-S128".to_string(),
arch: "x86_64".to_string(), arch: "x86_64".to_string(),
target_os: "macos".to_string(), target_os: "macos".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "apple".to_string(), target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -21,7 +21,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:o-i64:64-f80:128-n8:16:32:64-S128".to_string(), data_layout: "e-m:o-i64:64-f80:128-n8:16:32:64-S128".to_string(),
arch: "x86_64".to_string(), arch: "x86_64".to_string(),
target_os: "ios".to_string(), target_os: "ios".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "apple".to_string(), target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {

View file

@ -25,8 +25,8 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(), data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
arch: "x86_64".to_string(), arch: "x86_64".to_string(),
target_os: "fuchsia".to_string(), target_os: "fuchsia".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "".to_string(), target_vendor: String::new(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
}) })

View file

@ -27,7 +27,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(), data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
arch: "x86_64".to_string(), arch: "x86_64".to_string(),
target_os: "android".to_string(), target_os: "android".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -33,7 +33,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(), data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
arch: "x86_64".to_string(), arch: "x86_64".to_string(),
target_os: "netbsd".to_string(), target_os: "netbsd".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "rumprun".to_string(), target_vendor: "rumprun".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(), data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
arch: "x86_64".to_string(), arch: "x86_64".to_string(),
target_os: "solaris".to_string(), target_os: "solaris".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "sun".to_string(), target_vendor: "sun".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(), data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
arch: "x86_64".to_string(), arch: "x86_64".to_string(),
target_os: "bitrig".to_string(), target_os: "bitrig".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -26,7 +26,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(), data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
arch: "x86_64".to_string(), arch: "x86_64".to_string(),
target_os: "cloudabi".to_string(), target_os: "cloudabi".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(), data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
arch: "x86_64".to_string(), arch: "x86_64".to_string(),
target_os: "dragonfly".to_string(), target_os: "dragonfly".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(), data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
arch: "x86_64".to_string(), arch: "x86_64".to_string(),
target_os: "freebsd".to_string(), target_os: "freebsd".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -27,7 +27,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(), data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
arch: "x86_64".to_string(), arch: "x86_64".to_string(),
target_os: "haiku".to_string(), target_os: "haiku".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(), data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
arch: "x86_64".to_string(), arch: "x86_64".to_string(),
target_os: "hermit".to_string(), target_os: "hermit".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(), data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
arch: "x86_64".to_string(), arch: "x86_64".to_string(),
target_os: "netbsd".to_string(), target_os: "netbsd".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(), data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
arch: "x86_64".to_string(), arch: "x86_64".to_string(),
target_os: "openbsd".to_string(), target_os: "openbsd".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(), data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
arch: "x86_64".to_string(), arch: "x86_64".to_string(),
target_os: "redox".to_string(), target_os: "redox".to_string(),
target_env: "".to_string(), target_env: String::new(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,

View file

@ -3471,7 +3471,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
displayable_field_names.sort(); displayable_field_names.sort();
let truncated_fields_error = if len <= 3 { let truncated_fields_error = if len <= 3 {
"".to_string() String::new()
} else { } else {
format!(" and {} other field{}", (len - 3), if len - 3 == 1 {""} else {"s"}) format!(" and {} other field{}", (len - 3), if len - 3 == 1 {""} else {"s"})
}; };
@ -4783,7 +4783,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
err.span_suggestion_with_applicability( err.span_suggestion_with_applicability(
span_semi, span_semi,
"consider removing this semicolon", "consider removing this semicolon",
"".to_string(), String::new(),
Applicability::MachineApplicable); Applicability::MachineApplicable);
} }

View file

@ -142,7 +142,7 @@ fn unused_crates_lint<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) {
.span_suggestion_short_with_applicability( .span_suggestion_short_with_applicability(
span, span,
"remove it", "remove it",
"".to_string(), String::new(),
Applicability::MachineApplicable) Applicability::MachineApplicable)
.emit(); .emit();
continue; continue;

View file

@ -568,7 +568,7 @@ impl Clean<Item> for doctree::Module {
let name = if self.name.is_some() { let name = if self.name.is_some() {
self.name.expect("No name provided").clean(cx) self.name.expect("No name provided").clean(cx)
} else { } else {
"".to_string() String::new()
}; };
// maintain a stack of mod ids, for doc comment path resolution // maintain a stack of mod ids, for doc comment path resolution
@ -1760,7 +1760,7 @@ impl<'a, 'tcx> Clean<FnDecl> for (DefId, ty::PolyFnSig<'tcx>) {
values: sig.skip_binder().inputs().iter().map(|t| { values: sig.skip_binder().inputs().iter().map(|t| {
Argument { Argument {
type_: t.clean(cx), type_: t.clean(cx),
name: names.next().map_or("".to_string(), |name| name.to_string()), name: names.next().map_or(String::new(), |name| name.to_string()),
} }
}).collect(), }).collect(),
}, },
@ -3596,7 +3596,7 @@ impl Clean<Item> for hir::ForeignItem {
ForeignStaticItem(Static { ForeignStaticItem(Static {
type_: ty.clean(cx), type_: ty.clean(cx),
mutability: if mutbl {Mutable} else {Immutable}, mutability: if mutbl {Mutable} else {Immutable},
expr: "".to_string(), expr: String::new(),
}) })
} }
hir::ForeignItemKind::Type => { hir::ForeignItemKind::Type => {
@ -3628,7 +3628,7 @@ impl ToSource for syntax_pos::Span {
debug!("converting span {:?} to snippet", self.clean(cx)); debug!("converting span {:?} to snippet", self.clean(cx));
let sn = match cx.sess().source_map().span_to_snippet(*self) { let sn = match cx.sess().source_map().span_to_snippet(*self) {
Ok(x) => x.to_string(), Ok(x) => x.to_string(),
Err(_) => "".to_string() Err(_) => String::new()
}; };
debug!("got snippet {}", sn); debug!("got snippet {}", sn);
sn sn
@ -3824,19 +3824,19 @@ impl Clean<Stability> for attr::Stability {
feature: self.feature.to_string(), feature: self.feature.to_string(),
since: match self.level { since: match self.level {
attr::Stable {ref since} => since.to_string(), attr::Stable {ref since} => since.to_string(),
_ => "".to_string(), _ => String::new(),
}, },
deprecated_since: match self.rustc_depr { deprecated_since: match self.rustc_depr {
Some(attr::RustcDeprecation {ref since, ..}) => since.to_string(), Some(attr::RustcDeprecation {ref since, ..}) => since.to_string(),
_=> "".to_string(), _=> String::new(),
}, },
deprecated_reason: match self.rustc_depr { deprecated_reason: match self.rustc_depr {
Some(ref depr) => depr.reason.to_string(), Some(ref depr) => depr.reason.to_string(),
_ => "".to_string(), _ => String::new(),
}, },
unstable_reason: match self.level { unstable_reason: match self.level {
attr::Unstable { reason: Some(ref reason), .. } => reason.to_string(), attr::Unstable { reason: Some(ref reason), .. } => reason.to_string(),
_ => "".to_string(), _ => String::new(),
}, },
issue: match self.level { issue: match self.level {
attr::Unstable {issue, ..} => Some(issue), attr::Unstable {issue, ..} => Some(issue),
@ -3855,8 +3855,8 @@ impl<'a> Clean<Stability> for &'a attr::Stability {
impl Clean<Deprecation> for attr::Deprecation { impl Clean<Deprecation> for attr::Deprecation {
fn clean(&self, _: &DocContext) -> Deprecation { fn clean(&self, _: &DocContext) -> Deprecation {
Deprecation { Deprecation {
since: self.since.as_ref().map_or("".to_string(), |s| s.to_string()), since: self.since.as_ref().map_or(String::new(), |s| s.to_string()),
note: self.note.as_ref().map_or("".to_string(), |s| s.to_string()), note: self.note.as_ref().map_or(String::new(), |s| s.to_string()),
} }
} }
} }

View file

@ -620,7 +620,7 @@ fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter, use_absolute: bool) -> fmt:
clean::BorrowedRef{ lifetime: ref l, mutability, type_: ref ty} => { clean::BorrowedRef{ lifetime: ref l, mutability, type_: ref ty} => {
let lt = match *l { let lt = match *l {
Some(ref l) => format!("{} ", *l), Some(ref l) => format!("{} ", *l),
_ => "".to_string(), _ => String::new(),
}; };
let m = MutableSpace(mutability); let m = MutableSpace(mutability);
let amp = if f.alternate() { let amp = if f.alternate() {

View file

@ -156,13 +156,13 @@ pub fn render<T: fmt::Display, S: fmt::Display>(
root_path = page.root_path, root_path = page.root_path,
suffix=page.resource_suffix) suffix=page.resource_suffix)
} else { } else {
"".to_owned() String::new()
}, },
content = *t, content = *t,
root_path = page.root_path, root_path = page.root_path,
css_class = page.css_class, css_class = page.css_class,
logo = if layout.logo.is_empty() { logo = if layout.logo.is_empty() {
"".to_string() String::new()
} else { } else {
format!("<a href='{}{}/index.html'>\ format!("<a href='{}{}/index.html'>\
<img src='{}' alt='logo' width='100'></a>", <img src='{}' alt='logo' width='100'></a>",
@ -173,7 +173,7 @@ pub fn render<T: fmt::Display, S: fmt::Display>(
description = page.description, description = page.description,
keywords = page.keywords, keywords = page.keywords,
favicon = if layout.favicon.is_empty() { favicon = if layout.favicon.is_empty() {
"".to_string() String::new()
} else { } else {
format!(r#"<link rel="shortcut icon" href="{}">"#, layout.favicon) format!(r#"<link rel="shortcut icon" href="{}">"#, layout.favicon)
}, },

View file

@ -504,8 +504,8 @@ pub fn run(mut krate: clean::Crate,
local_sources: FxHashMap(), local_sources: FxHashMap(),
issue_tracker_base_url: None, issue_tracker_base_url: None,
layout: layout::Layout { layout: layout::Layout {
logo: "".to_string(), logo: String::new(),
favicon: "".to_string(), favicon: String::new(),
external_html: external_html.clone(), external_html: external_html.clone(),
krate: krate.name.clone(), krate: krate.name.clone(),
}, },
@ -2183,7 +2183,7 @@ fn shorter<'a>(s: Option<&'a str>) -> String {
!chr.is_whitespace() !chr.is_whitespace()
}) })
}).collect::<Vec<_>>().join("\n"), }).collect::<Vec<_>>().join("\n"),
None => "".to_string() None => String::new()
} }
} }
@ -2479,7 +2479,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
stab_docs = stab_docs, stab_docs = stab_docs,
docs = MarkdownSummaryLine(doc_value, &myitem.links()), docs = MarkdownSummaryLine(doc_value, &myitem.links()),
class = myitem.type_(), class = myitem.type_(),
stab = myitem.stability_class().unwrap_or("".to_string()), stab = myitem.stability_class().unwrap_or(String::new()),
unsafety_flag = unsafety_flag, unsafety_flag = unsafety_flag,
href = item_path(myitem.type_(), myitem.name.as_ref().unwrap()), href = item_path(myitem.type_(), myitem.name.as_ref().unwrap()),
title_type = myitem.type_(), title_type = myitem.type_(),

View file

@ -184,7 +184,7 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::Toke
Ok(..) => { Ok(..) => {
// Add this input file to the code map to make it available as // Add this input file to the code map to make it available as
// dependency information, but don't enter it's contents // dependency information, but don't enter it's contents
cx.source_map().new_source_file(file.into(), "".to_string()); cx.source_map().new_source_file(file.into(), String::new());
base::MacEager::expr(cx.expr_lit(sp, ast::LitKind::ByteStr(Lrc::new(bytes)))) base::MacEager::expr(cx.expr_lit(sp, ast::LitKind::ByteStr(Lrc::new(bytes))))
} }

View file

@ -230,7 +230,7 @@ fn trim_whitespace_prefix_and_push_line(lines: &mut Vec<String>, s: String, col:
if col < len { if col < len {
(&s[col..len]).to_string() (&s[col..len]).to_string()
} else { } else {
"".to_string() String::new()
} }
} }
None => s, None => s,

View file

@ -684,7 +684,7 @@ impl<'a> Parser<'a> {
let mut i = tokens.iter(); let mut i = tokens.iter();
// This might be a sign we need a connect method on Iterator. // This might be a sign we need a connect method on Iterator.
let b = i.next() let b = i.next()
.map_or("".to_string(), |t| t.to_string()); .map_or(String::new(), |t| t.to_string());
i.enumerate().fold(b, |mut b, (i, a)| { i.enumerate().fold(b, |mut b, (i, a)| {
if tokens.len() > 2 && i == tokens.len() - 2 { if tokens.len() > 2 && i == tokens.len() - 2 {
b.push_str(", or "); b.push_str(", or ");
@ -786,7 +786,7 @@ impl<'a> Parser<'a> {
} else { } else {
err.span_label(self.span, "expected identifier"); err.span_label(self.span, "expected identifier");
if self.token == token::Comma && self.look_ahead(1, |t| t.is_ident()) { if self.token == token::Comma && self.look_ahead(1, |t| t.is_ident()) {
err.span_suggestion(self.span, "remove this comma", "".into()); err.span_suggestion(self.span, "remove this comma", String::new());
} }
} }
err err
@ -2518,7 +2518,7 @@ impl<'a> Parser<'a> {
err.span_suggestion_short_with_applicability( err.span_suggestion_short_with_applicability(
self.span, self.span,
"remove this comma", "remove this comma",
"".to_owned(), String::new(),
Applicability::MachineApplicable Applicability::MachineApplicable
); );
err.note("the base struct must always be the last field"); err.note("the base struct must always be the last field");
@ -3485,7 +3485,7 @@ impl<'a> Parser<'a> {
e.span_suggestion_short_with_applicability( e.span_suggestion_short_with_applicability(
match_span, match_span,
"try removing this `match`", "try removing this `match`",
"".to_owned(), String::new(),
Applicability::MaybeIncorrect // speculative Applicability::MaybeIncorrect // speculative
); );
} }
@ -3862,7 +3862,7 @@ impl<'a> Parser<'a> {
if self.token == token::CloseDelim(token::Brace) { if self.token == token::CloseDelim(token::Brace) {
// If the struct looks otherwise well formed, recover and continue. // If the struct looks otherwise well formed, recover and continue.
if let Some(sp) = comma_sp { if let Some(sp) = comma_sp {
err.span_suggestion_short(sp, "remove this comma", "".into()); err.span_suggestion_short(sp, "remove this comma", String::new());
} }
err.emit(); err.emit();
break; break;
@ -3902,7 +3902,7 @@ impl<'a> Parser<'a> {
err.multipart_suggestion( err.multipart_suggestion(
"move the `..` to the end of the field list", "move the `..` to the end of the field list",
vec![ vec![
(etc_span, "".into()), (etc_span, String::new()),
(self.span, format!("{}.. }}", if ate_comma { "" } else { ", " })), (self.span, format!("{}.. }}", if ate_comma { "" } else { ", " })),
], ],
); );
@ -6210,7 +6210,7 @@ impl<'a> Parser<'a> {
if token_str == ";" { if token_str == ";" {
let msg = "consider removing this semicolon"; let msg = "consider removing this semicolon";
err.span_suggestion_short_with_applicability( err.span_suggestion_short_with_applicability(
self.span, msg, "".to_string(), Applicability::MachineApplicable self.span, msg, String::new(), Applicability::MachineApplicable
); );
if !items.is_empty() { // Issue #51603 if !items.is_empty() { // Issue #51603
let previous_item = &items[items.len()-1]; let previous_item = &items[items.len()-1];

View file

@ -1030,7 +1030,7 @@ mod tests {
cm.new_source_file(PathBuf::from("blork.rs").into(), cm.new_source_file(PathBuf::from("blork.rs").into(),
"first line.\nsecond line".to_string()); "first line.\nsecond line".to_string());
cm.new_source_file(PathBuf::from("empty.rs").into(), cm.new_source_file(PathBuf::from("empty.rs").into(),
"".to_string()); String::new());
cm.new_source_file(PathBuf::from("blork2.rs").into(), cm.new_source_file(PathBuf::from("blork2.rs").into(),
"first line.\nsecond line".to_string()); "first line.\nsecond line".to_string());
cm cm

View file

@ -102,7 +102,7 @@ impl<T: Write> OutputFormatter for JsonFormatter<T> {
let deviation = (bs.ns_iter_summ.max - bs.ns_iter_summ.min) as usize; let deviation = (bs.ns_iter_summ.max - bs.ns_iter_summ.min) as usize;
let mbps = if bs.mb_s == 0 { let mbps = if bs.mb_s == 0 {
"".into() String::new()
} else { } else {
format!(r#", "mib_per_second": {}"#, bs.mb_s) format!(r#", "mib_per_second": {}"#, bs.mb_s)
}; };

View file

@ -559,7 +559,7 @@ impl Config {
let mut strs: Vec<String> = nv.splitn(2, '=').map(str::to_owned).collect(); let mut strs: Vec<String> = nv.splitn(2, '=').map(str::to_owned).collect();
match strs.len() { match strs.len() {
1 => (strs.pop().unwrap(), "".to_owned()), 1 => (strs.pop().unwrap(), String::new()),
2 => { 2 => {
let end = strs.pop().unwrap(); let end = strs.pop().unwrap();
(strs.pop().unwrap(), end) (strs.pop().unwrap(), end)

View file

@ -252,7 +252,7 @@ pub fn collect_lib_features(base_src_path: &Path) -> Features {
// add it to the set of known library features so we can still generate docs. // add it to the set of known library features so we can still generate docs.
lib_features.insert("compiler_builtins_lib".to_owned(), Feature { lib_features.insert("compiler_builtins_lib".to_owned(), Feature {
level: Status::Unstable, level: Status::Unstable,
since: "".to_owned(), since: String::new(),
has_gate_test: false, has_gate_test: false,
tracking_issue: None, tracking_issue: None,
}); });