Rust fmt fixes

This commit is contained in:
Carlo Kok
2020-06-17 06:46:58 +02:00
parent 0b613caad1
commit b2549d1fde
3 changed files with 9 additions and 6 deletions

View File

@@ -215,7 +215,11 @@ impl Backend for FaerieBackend {
} = data_ctx.description(); } = data_ctx.description();
if let Some((segment, section)) = custom_segment_section { if let Some((segment, section)) = custom_segment_section {
return Err(cranelift_module::ModuleError::Backend(anyhow::anyhow!("Custom section not supported by cranelift-faerie: `{}:{}`", segment, section))); return Err(cranelift_module::ModuleError::Backend(anyhow::anyhow!(
"Custom section not supported by cranelift-faerie: `{}:{}`",
segment,
section
)));
} }
for &(offset, id) in function_relocs { for &(offset, id) in function_relocs {

View File

@@ -97,10 +97,7 @@ impl DataContext {
/// Override the segment/section for data, only supported on Object backend /// Override the segment/section for data, only supported on Object backend
pub fn set_segment_section(&mut self, seg: &str, sec: &str) { pub fn set_segment_section(&mut self, seg: &str, sec: &str) {
self.description.custom_segment_section = Some(( self.description.custom_segment_section = Some((seg.to_owned(), sec.to_owned()))
seg.to_owned(),
sec.to_owned(),
))
} }
/// Declare an external function import. /// Declare an external function import.

View File

@@ -284,7 +284,9 @@ impl Backend for ObjectBackend {
self.object.section_id(section_kind) self.object.section_id(section_kind)
} else { } else {
if tls { if tls {
return Err(cranelift_module::ModuleError::Backend(anyhow::anyhow!("Custom section not supported for TLS"))); return Err(cranelift_module::ModuleError::Backend(anyhow::anyhow!(
"Custom section not supported for TLS"
)));
} }
let (seg, sec) = &custom_segment_section.as_ref().unwrap(); let (seg, sec) = &custom_segment_section.as_ref().unwrap();
self.object.add_section( self.object.add_section(