summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2018-08-14 22:09:52 +0200
committerEmilio Cobos Álvarez <emilio@crisal.io>2018-08-14 22:09:52 +0200
commitbb6a1205a0e81271bf90aec33d33e2e3ca0ae7d1 (patch)
tree5719d69012f865ab2a3cd737698c527291e0041c
parenta1c9129238b5c8f5101d25b5a407d491d4234800 (diff)
Minor stylistic nits after #1362.
-rw-r--r--src/codegen/mod.rs20
-rw-r--r--src/ir/item.rs24
-rw-r--r--src/lib.rs32
3 files changed, 24 insertions, 52 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 27ddcfea..cdf0134a 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -1978,20 +1978,12 @@ impl MethodCodegen for Method {
assert!({
let cc = &ctx.options().codegen_config;
match self.kind() {
- MethodKind::Constructor => {
- cc.constructors()
- }
- MethodKind::Destructor => {
- cc.destructors()
- }
- MethodKind::VirtualDestructor { .. } => {
- cc.destructors()
- }
- MethodKind::Static
- | MethodKind::Normal
- | MethodKind::Virtual { .. } => {
- cc.methods()
- }
+ MethodKind::Constructor => cc.constructors(),
+ MethodKind::Destructor => cc.destructors(),
+ MethodKind::VirtualDestructor { .. } => cc.destructors(),
+ MethodKind::Static |
+ MethodKind::Normal |
+ MethodKind::Virtual { .. } => cc.methods(),
}
});
diff --git a/src/ir/item.rs b/src/ir/item.rs
index c467c27f..75638ff3 100644
--- a/src/ir/item.rs
+++ b/src/ir/item.rs
@@ -953,21 +953,17 @@ impl Item {
ItemKind::Module(..) => true,
ItemKind::Var(_) => cc.vars(),
ItemKind::Type(_) => cc.types(),
- ItemKind::Function(ref f) => match f.kind() {
- FunctionKind::Function => cc.functions(),
- FunctionKind::Method(MethodKind::Constructor) => {
- cc.constructors()
+ ItemKind::Function(ref f) => {
+ match f.kind() {
+ FunctionKind::Function => cc.functions(),
+ FunctionKind::Method(MethodKind::Constructor) => cc.constructors(),
+ FunctionKind::Method(MethodKind::Destructor) |
+ FunctionKind::Method(MethodKind::VirtualDestructor { .. }) => cc.destructors(),
+ FunctionKind::Method(MethodKind::Static) |
+ FunctionKind::Method(MethodKind::Normal) |
+ FunctionKind::Method(MethodKind::Virtual { .. }) => cc.methods(),
}
- FunctionKind::Method(MethodKind::Destructor) |
- FunctionKind::Method(MethodKind::VirtualDestructor {
- ..
- }) => cc.destructors(),
- FunctionKind::Method(MethodKind::Static) |
- FunctionKind::Method(MethodKind::Normal) |
- FunctionKind::Method(MethodKind::Virtual { .. }) => {
- cc.methods()
- }
- },
+ }
}
}
}
diff --git a/src/lib.rs b/src/lib.rs
index 77b32120..eaa2c620 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -400,11 +400,7 @@ impl Builder {
output_vector.push("--disable-name-namespacing".into());
}
- if !self
- .options
- .codegen_config
- .contains(CodegenConfig::FUNCTIONS)
- {
+ if !self.options.codegen_config.functions() {
output_vector.push("--ignore-functions".into());
}
@@ -412,40 +408,28 @@ impl Builder {
//Temporary placeholder for below 4 options
let mut options: Vec<String> = Vec::new();
- if self
- .options
- .codegen_config
- .contains(CodegenConfig::FUNCTIONS)
- {
+ if self.options.codegen_config.functions() {
options.push("function".into());
}
- if self.options.codegen_config.contains(CodegenConfig::TYPES) {
+ if self.options.codegen_config.types() {
options.push("types".into());
}
- if self.options.codegen_config.contains(CodegenConfig::VARS) {
+ if self.options.codegen_config.vars() {
options.push("vars".into());
}
- if self.options.codegen_config.contains(CodegenConfig::METHODS) {
+ if self.options.codegen_config.methods() {
options.push("methods".into());
}
- if self
- .options
- .codegen_config
- .contains(CodegenConfig::CONSTRUCTORS)
- {
+ if self.options.codegen_config.constructors() {
options.push("constructors".into());
}
- if self
- .options
- .codegen_config
- .contains(CodegenConfig::DESTRUCTORS)
- {
+ if self.options.codegen_config.destructors() {
options.push("destructors".into());
}
output_vector.push(options.join(","));
- if !self.options.codegen_config.contains(CodegenConfig::METHODS) {
+ if !self.options.codegen_config.methods() {
output_vector.push("--ignore-methods".into());
}