Clippy fixes (#692)
This commit is contained in:
@@ -29,7 +29,7 @@ impl SymbolResolver for FunctionRelocResolver {
|
||||
pub fn emit_debugsections(
|
||||
obj: &mut Artifact,
|
||||
vmctx_info: &ModuleVmctxInfo,
|
||||
target_config: &TargetFrontendConfig,
|
||||
target_config: TargetFrontendConfig,
|
||||
debuginfo_data: &DebugInfoData,
|
||||
at: &ModuleAddressMap,
|
||||
ranges: &ValueLabelsRanges,
|
||||
@@ -53,7 +53,7 @@ impl<'a> SymbolResolver for ImageRelocResolver<'a> {
|
||||
|
||||
pub fn emit_debugsections_image(
|
||||
triple: Triple,
|
||||
target_config: &TargetFrontendConfig,
|
||||
target_config: TargetFrontendConfig,
|
||||
debuginfo_data: &DebugInfoData,
|
||||
vmctx_info: &ModuleVmctxInfo,
|
||||
at: &ModuleAddressMap,
|
||||
|
||||
@@ -155,11 +155,8 @@ fn build_function_lookup(
|
||||
active_ranges.push(range_index);
|
||||
continue;
|
||||
}
|
||||
if last_wasm_pos.is_some() {
|
||||
index.insert(
|
||||
last_wasm_pos.unwrap(),
|
||||
active_ranges.clone().into_boxed_slice(),
|
||||
);
|
||||
if let Some(position) = last_wasm_pos {
|
||||
index.insert(position, active_ranges.clone().into_boxed_slice());
|
||||
}
|
||||
active_ranges.retain(|r| ranges[*r].wasm_end.cmp(&wasm_start) != std::cmp::Ordering::Less);
|
||||
active_ranges.push(range_index);
|
||||
|
||||
@@ -201,8 +201,8 @@ where
|
||||
}
|
||||
found_expr
|
||||
};
|
||||
if found_single_expr.is_some() {
|
||||
write::AttributeValue::Exprloc(found_single_expr.unwrap())
|
||||
if let Some(expr) = found_single_expr {
|
||||
write::AttributeValue::Exprloc(expr)
|
||||
} else if is_exprloc_to_loclist_allowed(attr.name()) {
|
||||
// Converting exprloc to loclist.
|
||||
let mut locs = Vec::new();
|
||||
|
||||
@@ -323,7 +323,7 @@ where
|
||||
assert_eq!(ty, 0);
|
||||
let index = pc.read_sleb128()?;
|
||||
pc.read_u8()?; // consume 159
|
||||
if code_chunk.len() > 0 {
|
||||
if !code_chunk.is_empty() {
|
||||
parts.push(CompiledExpressionPart::Code(code_chunk));
|
||||
code_chunk = Vec::new();
|
||||
}
|
||||
@@ -338,7 +338,7 @@ where
|
||||
need_deref = false;
|
||||
}
|
||||
Operation::Deref { .. } => {
|
||||
if code_chunk.len() > 0 {
|
||||
if !code_chunk.is_empty() {
|
||||
parts.push(CompiledExpressionPart::Code(code_chunk));
|
||||
code_chunk = Vec::new();
|
||||
}
|
||||
@@ -353,14 +353,14 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
if code_chunk.len() > 0 {
|
||||
if !code_chunk.is_empty() {
|
||||
parts.push(CompiledExpressionPart::Code(code_chunk));
|
||||
}
|
||||
|
||||
if base_len > 0 && base_len + 1 < parts.len() {
|
||||
// see if we can glue two code chunks
|
||||
if let [CompiledExpressionPart::Code(cc1), CompiledExpressionPart::Code(cc2)] =
|
||||
&parts[base_len..base_len + 1]
|
||||
&parts[base_len..=base_len]
|
||||
{
|
||||
let mut combined = cc1.clone();
|
||||
combined.extend_from_slice(cc2);
|
||||
|
||||
@@ -45,7 +45,7 @@ where
|
||||
}
|
||||
|
||||
pub fn transform_dwarf(
|
||||
target_config: &TargetFrontendConfig,
|
||||
target_config: TargetFrontendConfig,
|
||||
di: &DebugInfoData,
|
||||
at: &ModuleAddressMap,
|
||||
vmctx_info: &ModuleVmctxInfo,
|
||||
|
||||
@@ -67,10 +67,10 @@ impl RangeInfoBuilder {
|
||||
result.push((range.begin, range.end));
|
||||
}
|
||||
|
||||
Ok(if result.len() > 0 {
|
||||
RangeInfoBuilder::Ranges(result)
|
||||
} else {
|
||||
Ok(if result.is_empty() {
|
||||
RangeInfoBuilder::Undefined
|
||||
} else {
|
||||
RangeInfoBuilder::Ranges(result)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -51,37 +51,34 @@ where
|
||||
R: Reader,
|
||||
{
|
||||
// FIXME remove recursion.
|
||||
match type_entry.attr_value(gimli::DW_AT_type)? {
|
||||
Some(AttributeValue::UnitRef(ref offset)) => {
|
||||
let mut entries = unit.entries_at_offset(*offset)?;
|
||||
entries.next_entry()?;
|
||||
if let Some(die) = entries.current() {
|
||||
if let Some(AttributeValue::DebugStrRef(str_offset)) =
|
||||
die.attr_value(gimli::DW_AT_name)?
|
||||
{
|
||||
return Ok(String::from(
|
||||
context.debug_str.get_str(str_offset)?.to_string()?,
|
||||
));
|
||||
if let Some(AttributeValue::UnitRef(ref offset)) = type_entry.attr_value(gimli::DW_AT_type)? {
|
||||
let mut entries = unit.entries_at_offset(*offset)?;
|
||||
entries.next_entry()?;
|
||||
if let Some(die) = entries.current() {
|
||||
if let Some(AttributeValue::DebugStrRef(str_offset)) =
|
||||
die.attr_value(gimli::DW_AT_name)?
|
||||
{
|
||||
return Ok(String::from(
|
||||
context.debug_str.get_str(str_offset)?.to_string()?,
|
||||
));
|
||||
}
|
||||
match die.tag() {
|
||||
gimli::DW_TAG_const_type => {
|
||||
return Ok(format!("const {}", get_base_type_name(die, unit, context)?));
|
||||
}
|
||||
match die.tag() {
|
||||
gimli::DW_TAG_const_type => {
|
||||
return Ok(format!("const {}", get_base_type_name(die, unit, context)?));
|
||||
}
|
||||
gimli::DW_TAG_pointer_type => {
|
||||
return Ok(format!("{}*", get_base_type_name(die, unit, context)?));
|
||||
}
|
||||
gimli::DW_TAG_reference_type => {
|
||||
return Ok(format!("{}&", get_base_type_name(die, unit, context)?));
|
||||
}
|
||||
gimli::DW_TAG_array_type => {
|
||||
return Ok(format!("{}[]", get_base_type_name(die, unit, context)?));
|
||||
}
|
||||
_ => (),
|
||||
gimli::DW_TAG_pointer_type => {
|
||||
return Ok(format!("{}*", get_base_type_name(die, unit, context)?));
|
||||
}
|
||||
gimli::DW_TAG_reference_type => {
|
||||
return Ok(format!("{}&", get_base_type_name(die, unit, context)?));
|
||||
}
|
||||
gimli::DW_TAG_array_type => {
|
||||
return Ok(format!("{}[]", get_base_type_name(die, unit, context)?));
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
_ => (),
|
||||
};
|
||||
}
|
||||
Ok(String::from("??"))
|
||||
}
|
||||
|
||||
@@ -121,11 +118,8 @@ where
|
||||
gimli::DW_AT_type,
|
||||
write::AttributeValue::ThisUnitEntryRef(wp_die_id),
|
||||
);
|
||||
match entry.attr_value(gimli::DW_AT_type)? {
|
||||
Some(AttributeValue::UnitRef(ref offset)) => {
|
||||
pending_die_refs.push((p_die_id, gimli::DW_AT_type, *offset))
|
||||
}
|
||||
_ => (),
|
||||
if let Some(AttributeValue::UnitRef(ref offset)) = entry.attr_value(gimli::DW_AT_type)? {
|
||||
pending_die_refs.push((p_die_id, gimli::DW_AT_type, *offset))
|
||||
}
|
||||
|
||||
let m_die_id = comp_unit.add(die_id, gimli::DW_TAG_member);
|
||||
|
||||
Reference in New Issue
Block a user