Skip to content

Commit c1a2199

Browse files
committed
squash! Dead code and imports cleanup
1 parent 9bf17af commit c1a2199

File tree

6 files changed

+14
-16
lines changed

6 files changed

+14
-16
lines changed

src/codegen/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use ir::ty::{Type, TypeKind};
44
use ir::int::IntKind;
55
use ir::module::Module;
66
use ir::var::Var;
7-
use ir::enum_ty::{Enum, EnumVariant};
7+
use ir::enum_ty::Enum;
88
use ir::function::{Function, FunctionSig};
99
use ir::item_kind::ItemKind;
1010
use ir::comp::{CompKind, CompInfo, Field, Method};
@@ -474,7 +474,9 @@ impl CodeGenerator for Type {
474474

475475
struct Vtable<'a> {
476476
item_id: ItemId,
477+
#[allow(dead_code)]
477478
methods: &'a [Method],
479+
#[allow(dead_code)]
478480
base_classes: &'a [ItemId],
479481
}
480482

@@ -519,15 +521,13 @@ impl<'a> ItemToRustTy for Vtable<'a> {
519521
}
520522

521523
struct Bitfield<'a> {
522-
item: &'a Item,
523524
index: usize,
524525
fields: Vec<&'a Field>,
525526
}
526527

527528
impl<'a> Bitfield<'a> {
528-
fn new(item: &'a Item, index: usize, fields: Vec<&'a Field>) -> Self {
529+
fn new(index: usize, fields: Vec<&'a Field>) -> Self {
529530
Bitfield {
530-
item: item,
531531
index: index,
532532
fields: fields,
533533
}
@@ -777,7 +777,7 @@ impl CodeGenerator for CompInfo {
777777
let bitfield_fields =
778778
mem::replace(&mut current_bitfield_fields, vec![]);
779779
bitfield_count += 1;
780-
Bitfield::new(item, bitfield_count, bitfield_fields)
780+
Bitfield::new(bitfield_count, bitfield_fields)
781781
.codegen_fields(ctx, &mut fields, &mut methods);
782782
current_bitfield_width = None;
783783
current_bitfield_layout = None;
@@ -908,7 +908,7 @@ impl CodeGenerator for CompInfo {
908908
debug_assert!(!current_bitfield_fields.is_empty());
909909
let bitfield_fields = mem::replace(&mut current_bitfield_fields, vec![]);
910910
bitfield_count += 1;
911-
Bitfield::new(item, bitfield_count, bitfield_fields)
911+
Bitfield::new(bitfield_count, bitfield_fields)
912912
.codegen_fields(ctx, &mut fields, &mut methods);
913913
}
914914
debug_assert!(current_bitfield_fields.is_empty());
@@ -1082,7 +1082,7 @@ impl MethodCodegen for Method {
10821082
methods: &mut Vec<ast::ImplItem>,
10831083
method_names: &mut HashMap<String, usize>,
10841084
result: &mut CodegenResult,
1085-
parent: &Item) {
1085+
_parent: &Item) {
10861086
if ctx.options().ignore_methods {
10871087
return;
10881088
}
@@ -1701,7 +1701,7 @@ impl TypeCollector for FunctionSig {
17011701
fn collect_types(&self,
17021702
context: &BindgenContext,
17031703
types: &mut ItemSet,
1704-
item: &Item) {
1704+
_item: &Item) {
17051705
self.return_type().collect_types(context, types, &());
17061706

17071707
for &(_, ty) in self.argument_types() {

src/ir/enum_ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl Enum {
5656
None => true,
5757
};
5858

59-
declaration.visit(|cursor, other| {
59+
declaration.visit(|cursor, _| {
6060
if cursor.kind() == CXCursor_EnumConstantDecl {
6161
let name = cursor.spelling();
6262
let comment = cursor.raw_comment();

src/ir/function.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,11 @@ fn get_abi(cc: Enum_CXCallingConv) -> abi::Abi {
7474
}
7575
}
7676

77-
pub fn cursor_mangling(cursor: &clang::Cursor, ctx: &BindgenContext) -> Option<String> {
77+
pub fn cursor_mangling(cursor: &clang::Cursor) -> Option<String> {
7878
let mut mangling = cursor.mangling();
7979

8080
// Try to undo backend linkage munging (prepended _, generally)
8181
if cfg!(target_os = "macos") {
82-
// || (cfg!(target_os = "windows") && !ctx.options.msvc_mangling)
8382
mangling.remove(0);
8483
}
8584

@@ -208,7 +207,7 @@ impl ClangSubItemParser for Function {
208207
let name = cursor.spelling();
209208
assert!(!name.is_empty(), "Empty function name?");
210209

211-
let mut mangled_name = cursor_mangling(&cursor, context);
210+
let mut mangled_name = cursor_mangling(&cursor);
212211
if mangled_name.as_ref() == Some(&name) {
213212
mangled_name = None;
214213
}

src/ir/item.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,6 @@ impl ClangItemParser for Item {
436436
location: Option<clang::Cursor>,
437437
parent_id: Option<ItemId>,
438438
context: &mut BindgenContext) -> ItemId {
439-
use clangll::*;
440439
debug!("from_ty_or_ref: {:?}, {:?}, {:?}", ty, location, parent_id);
441440

442441
if context.collected_typerefs() {

src/ir/module.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::context::BindgenContext;
2-
use super::item::{ItemId, Item};
2+
use super::item::ItemId;
33
use clang;
4-
use parse::{ClangItemParser, ClangSubItemParser, ParseError, ParseResult};
4+
use parse::{ClangSubItemParser, ParseError, ParseResult};
55
use parse_one;
66

77
/// A module, as in, a C++ namespace.

src/ir/var.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ impl ClangSubItemParser for Var {
123123
});
124124
}
125125

126-
let mangling = cursor_mangling(&cursor, context);
126+
let mangling = cursor_mangling(&cursor);
127127

128128
let var = Var::new(name, mangling, ty, value, is_const);
129129
Ok(ParseResult::New(var, Some(cursor)))

0 commit comments

Comments
 (0)