diff --git a/src/analysis/bounds.rs b/src/analysis/bounds.rs index 8ab4153f5..8f722352c 100644 --- a/src/analysis/bounds.rs +++ b/src/analysis/bounds.rs @@ -209,7 +209,7 @@ impl Bounds { self.used.push(Bound { bound_type: BoundType::with_lifetime(*sub, lifetime), parameter_name: name.to_owned(), - alias: alias, + alias, type_str: type_str.to_owned(), info_for_next_type: true, }); @@ -222,9 +222,9 @@ impl Bounds { }; if let Some(alias) = self.unused.pop_front() { self.used.push(Bound { - bound_type: bound_type, + bound_type, parameter_name: name.to_owned(), - alias: alias, + alias, type_str: type_str.to_owned(), info_for_next_type: false, }); diff --git a/src/analysis/child_properties.rs b/src/analysis/child_properties.rs index 70484a968..d9a1e9855 100644 --- a/src/analysis/child_properties.rs +++ b/src/analysis/child_properties.rs @@ -118,17 +118,17 @@ fn analyze_property( ) }; Some(ChildProperty { - name: name, - typ: typ, + name, + typ, child_name: child_name.to_owned(), - child_type: child_type, - nullable: nullable, - get_out_ref_mode: get_out_ref_mode, - set_in_ref_mode: set_in_ref_mode, - doc_hidden: doc_hidden, - set_params: set_params, + child_type, + nullable, + get_out_ref_mode, + set_in_ref_mode, + doc_hidden, + set_params, bounds: bounds_str, - is_into: is_into, + is_into, to_glib_extra: String::new(), }) } else { diff --git a/src/analysis/class_hierarchy.rs b/src/analysis/class_hierarchy.rs index 6fda307c9..6dec53c11 100644 --- a/src/analysis/class_hierarchy.rs +++ b/src/analysis/class_hierarchy.rs @@ -18,7 +18,7 @@ pub fn run(library: &Library) -> Info { for (tid, _) in library.types() { get_node(library, &mut hier, tid); } - Info { hier: hier } + Info { hier } } fn get_node<'a>( @@ -56,7 +56,7 @@ fn get_node<'a>( hier.insert( tid, Node { - supers: supers, + supers, subs: HashSet::new(), }, ); diff --git a/src/analysis/constants.rs b/src/analysis/constants.rs index d6df9e6e6..63e438016 100644 --- a/src/analysis/constants.rs +++ b/src/analysis/constants.rs @@ -56,12 +56,12 @@ pub fn analyze>( let name = nameutil::mangle_keywords(&*constant.name).into_owned(); consts.push(Info { - name: name, + name, glib_name: constant.c_identifier.clone(), typ: constant.typ, - version: version, - deprecated_version: deprecated_version, - cfg_condition: cfg_condition, + version, + deprecated_version, + cfg_condition, }); } diff --git a/src/analysis/function_parameters.rs b/src/analysis/function_parameters.rs index 04b7e3332..b355e20f9 100644 --- a/src/analysis/function_parameters.rs +++ b/src/analysis/function_parameters.rs @@ -130,7 +130,7 @@ impl Parameters { }; let transformation = Transformation { - ind_c: ind_c, + ind_c, ind_rust: None, transformation_type: get_length_type(env, "", &par.name, par.typ), }; @@ -191,7 +191,7 @@ pub fn analyze( add_rust_parameter = false; let transformation = Transformation { - ind_c: ind_c, + ind_c, ind_rust: None, transformation_type: get_length_type(env, &array_name, &par.name, par.typ), }; @@ -227,10 +227,10 @@ pub fn analyze( c_type: par.c_type.clone(), instance_parameter: par.instance_parameter, direction: par.direction, - transfer: transfer, - caller_allocates: caller_allocates, - nullable: nullable, - ref_mode: ref_mode, + transfer, + caller_allocates, + nullable, + ref_mode, is_error: par.is_error, }; parameters.c_parameters.push(c_par); @@ -242,7 +242,7 @@ pub fn analyze( let rust_par = RustParameter { name: name.clone(), typ: par.typ, - ind_c: ind_c, + ind_c, allow_none: par.allow_none, }; parameters.rust_parameters.push(rust_par); @@ -250,20 +250,20 @@ pub fn analyze( if *nullable && is_into(env, par) && !(async_func && (name == data_param_name || name == callback_param_name)) { let with_stash = ref_mode == RefMode::ByRef; let transformation = Transformation { - ind_c: ind_c, - ind_rust: ind_rust, + ind_c, + ind_rust, transformation_type: TransformationType::Into { name: name.clone(), - with_stash: with_stash, + with_stash, }, }; parameters.transformations.push(transformation); if with_stash { parameters.transformations.push(Transformation { - ind_c: ind_c, - ind_rust: ind_rust, - transformation_type: TransformationType::ToGlibStash { name: name }, + ind_c, + ind_rust, + transformation_type: TransformationType::ToGlibStash { name }, }); continue; @@ -274,26 +274,26 @@ pub fn analyze( } let transformation_type = match ConversionType::of(env, par.typ) { - ConversionType::Direct => TransformationType::ToGlibDirect { name: name }, + ConversionType::Direct => TransformationType::ToGlibDirect { name }, ConversionType::Scalar => TransformationType::ToGlibScalar { - name: name, - nullable: nullable, + name, + nullable, }, ConversionType::Pointer => TransformationType::ToGlibPointer { - name: name, + name, instance_parameter: par.instance_parameter, - transfer: transfer, - ref_mode: ref_mode, + transfer, + ref_mode, to_glib_extra: String::new(), }, ConversionType::Borrow => TransformationType::ToGlibBorrow, - ConversionType::Unknown => TransformationType::ToGlibUnknown { name: name }, + ConversionType::Unknown => TransformationType::ToGlibUnknown { name }, }; let mut transformation = Transformation { - ind_c: ind_c, - ind_rust: ind_rust, - transformation_type: transformation_type, + ind_c, + ind_rust, + transformation_type, }; let mut typ = None; match transformation.transformation_type { @@ -346,7 +346,7 @@ fn get_length_type( TransformationType::Length { array_name: array_name.to_string(), array_length_name: length_name.to_string(), - array_length_type: array_length_type, + array_length_type, } } diff --git a/src/analysis/functions.rs b/src/analysis/functions.rs index 8523e44a4..391d9dc11 100644 --- a/src/analysis/functions.rs +++ b/src/analysis/functions.rs @@ -291,21 +291,21 @@ fn analyze_function( let assertion = SafetyAssertionMode::of(env, is_method, ¶meters); Info { - name: name, + name, glib_name: func.c_identifier.as_ref().unwrap().clone(), kind: func.kind, - visibility: visibility, + visibility, type_name: rust_type(env, type_tid), - parameters: parameters, - ret: ret, - bounds: bounds, - outs: outs, - version: version, - deprecated_version: deprecated_version, + parameters, + ret, + bounds, + outs, + version, + deprecated_version, not_version: None, - cfg_condition: cfg_condition, - assertion: assertion, - doc_hidden: doc_hidden, + cfg_condition, + assertion, + doc_hidden, async, trampoline, } diff --git a/src/analysis/mod.rs b/src/analysis/mod.rs index aa0301da5..fcd47a0aa 100644 --- a/src/analysis/mod.rs +++ b/src/analysis/mod.rs @@ -120,11 +120,11 @@ fn analyze_global_functions(env: &mut Env) { ); env.analysis.global_functions = Some(info_base::InfoBase { - full_name: full_name, + full_name, type_id: TypeId::tid_none(), name: "*".into(), - functions: functions, - imports: imports, + functions, + imports, ..Default::default() }); } diff --git a/src/analysis/namespaces.rs b/src/analysis/namespaces.rs index df93cfe89..fe1119345 100644 --- a/src/analysis/namespaces.rs +++ b/src/analysis/namespaces.rs @@ -57,9 +57,9 @@ pub fn run(gir: &library::Library) -> Info { }; namespaces.push(Namespace { name: ns.name.clone(), - crate_name: crate_name, - ffi_crate_name: ffi_crate_name, - higher_crate_name: higher_crate_name, + crate_name, + ffi_crate_name, + higher_crate_name, package_name: ns.package_name.clone(), shared_libs: ns.shared_library.clone(), versions: ns.versions.iter().cloned().collect(), @@ -70,7 +70,7 @@ pub fn run(gir: &library::Library) -> Info { } Info { - namespaces: namespaces, + namespaces, glib_ns_id: glib_ns_id.expect("Missing `GLib` namespace!"), } } diff --git a/src/analysis/object.rs b/src/analysis/object.rs index 793970771..803280101 100644 --- a/src/analysis/object.rs +++ b/src/analysis/object.rs @@ -186,14 +186,14 @@ pub fn class(env: &Env, obj: &GObject, deps: &[library::TypeId]) -> Option } let base = InfoBase { - full_name: full_name, + full_name, type_id: class_tid, - name: name, - functions: functions, - specials: specials, - imports: imports, - version: version, - deprecated_version: deprecated_version, + name, + functions, + specials, + imports, + version, + deprecated_version, cfg_condition: obj.cfg_condition.clone(), concurrency: obj.concurrency, }; @@ -212,22 +212,22 @@ pub fn class(env: &Env, obj: &GObject, deps: &[library::TypeId]) -> Option let has_functions = !base.functions().is_empty(); let info = Info { - base: base, + base, c_type: klass.c_type.clone(), c_class_type: klass.c_class_type.clone(), get_type: klass.glib_get_type.clone(), - supertypes: supertypes, - generate_trait: generate_trait, - trait_name: trait_name, - has_constructors: has_constructors, - has_methods: has_methods, - has_functions: has_functions, - signals: signals, - notify_signals: notify_signals, - trampolines: trampolines, - properties: properties, - child_properties: child_properties, - signatures: signatures, + supertypes, + generate_trait, + trait_name, + has_constructors, + has_methods, + has_functions, + signals, + notify_signals, + trampolines, + properties, + child_properties, + signatures, }; Some(info) @@ -315,14 +315,14 @@ pub fn interface(env: &Env, obj: &GObject, deps: &[library::TypeId]) -> Option Option Option { special_functions::analyze_imports(&specials, &mut imports); let base = InfoBase { - full_name: full_name, + full_name, type_id: record_tid, - name: name, - functions: functions, - specials: specials, - imports: imports, - version: version, - deprecated_version: deprecated_version, + name, + functions, + specials, + imports, + version, + deprecated_version, cfg_condition: obj.cfg_condition.clone(), concurrency: obj.concurrency, }; let info = Info { - base: base, + base, glib_get_type: record.glib_get_type.clone(), - use_boxed_functions: use_boxed_functions, + use_boxed_functions, }; Some(info) diff --git a/src/analysis/return_value.rs b/src/analysis/return_value.rs index ee383152b..5a090b5a7 100644 --- a/src/analysis/return_value.rs +++ b/src/analysis/return_value.rs @@ -42,7 +42,7 @@ pub fn analyze( nullable = val; } Some(library::Parameter { - nullable: nullable, + nullable, ..func.ret.clone() }) }; @@ -101,9 +101,9 @@ pub fn analyze( } Info { - parameter: parameter, - base_tid: base_tid, - commented: commented, + parameter, + base_tid, + commented, bool_return_is_error: bool_return_error_message, } } diff --git a/src/analysis/signals.rs b/src/analysis/signals.rs index 11b531a20..107f2552e 100644 --- a/src/analysis/signals.rs +++ b/src/analysis/signals.rs @@ -112,13 +112,13 @@ fn analyze_signal( } let info = Info { - connect_name: connect_name, + connect_name, signal_name: signal.name.clone(), - trampoline_name: trampoline_name, - action_emit_name: action_emit_name, - version: version, - deprecated_version: deprecated_version, - doc_hidden: doc_hidden, + trampoline_name, + action_emit_name, + version, + deprecated_version, + doc_hidden, }; Some(info) } diff --git a/src/analysis/supertypes.rs b/src/analysis/supertypes.rs index a8587dd85..aa76b4104 100644 --- a/src/analysis/supertypes.rs +++ b/src/analysis/supertypes.rs @@ -22,7 +22,7 @@ pub fn analyze(env: &Env, type_id: TypeId, imports: &mut Imports) -> Vec Info { ..Default::default() }; let tid = TypeId { - ns_id: ns_id, + ns_id, id: pos as u32, }; diff --git a/src/analysis/trampoline_parameters.rs b/src/analysis/trampoline_parameters.rs index f5da3cacf..41d920453 100644 --- a/src/analysis/trampoline_parameters.rs +++ b/src/analysis/trampoline_parameters.rs @@ -66,7 +66,7 @@ impl Parameters { let c_par = CParameter { name: name.clone(), typ: type_tid, - c_type: c_type, + c_type, }; let ind_c = self.c_parameters.len(); self.c_parameters.push(c_par); @@ -74,22 +74,22 @@ impl Parameters { let rust_par = RustParameter { name: name.clone(), typ: type_tid, - direction: direction, - nullable: nullable, - ref_mode: ref_mode, + direction, + nullable, + ref_mode, }; let ind_rust = self.rust_parameters.len(); self.rust_parameters.push(rust_par); Transformation { - ind_c: ind_c, - ind_rust: ind_rust, + ind_c, + ind_rust, transformation: TransformationType::None, - name: name, + name, typ: type_tid, - transfer: transfer, - ref_mode: ref_mode, - conversion_type: conversion_type, + transfer, + ref_mode, + conversion_type, } } diff --git a/src/analysis/trampolines.rs b/src/analysis/trampolines.rs index 5e5309118..435a7caa3 100644 --- a/src/analysis/trampolines.rs +++ b/src/analysis/trampolines.rs @@ -139,13 +139,13 @@ pub fn analyze( let trampoline = Trampoline { name: name.clone(), - parameters: parameters, - ret: ret, - bounds: bounds, - version: version, - inhibit: inhibit, - concurrency: concurrency, - is_notify: is_notify, + parameters, + ret, + bounds, + version, + inhibit, + concurrency, + is_notify, }; trampolines.push(trampoline); Ok(name) diff --git a/src/codegen/doc/mod.rs b/src/codegen/doc/mod.rs index 81014be55..a790a86f6 100644 --- a/src/codegen/doc/mod.rs +++ b/src/codegen/doc/mod.rs @@ -368,7 +368,7 @@ where let symbols = env.symbols.borrow(); let ty = TypeStruct { - parent: parent, + parent, ..fn_.to_stripper_type() }; let self_name: Option = fn_.parameters() @@ -454,7 +454,7 @@ fn create_property_doc( } if property.writable { v.push(TypeStruct { - parent: parent, + parent, ..TypeStruct::new(SType::Fn, &format!("set_property_{}", property.name)) }); } diff --git a/src/codegen/enums.rs b/src/codegen/enums.rs index ff5aa97af..ee72cf03c 100644 --- a/src/codegen/enums.rs +++ b/src/codegen/enums.rs @@ -106,8 +106,8 @@ fn generate_enum(env: &Env, w: &mut Write, enum_: &Enumeration, config: &GObject name: member.name.to_camel(), c_name: member.c_identifier.clone(), value: member.value.clone(), - version: version, - deprecated_version: deprecated_version, + version, + deprecated_version, }); } diff --git a/src/codegen/function_body_chunk.rs b/src/codegen/function_body_chunk.rs index 442d83dff..747b3c603 100644 --- a/src/codegen/function_body_chunk.rs +++ b/src/codegen/function_body_chunk.rs @@ -79,7 +79,7 @@ impl Builder { let mem_mode = c_type_mem_mode(env, parameter); self.parameters.push(Parameter::Out { parameter: parameter_ffi_call_out::Parameter::new(parameter), - mem_mode: mem_mode, + mem_mode, }); self.outs_as_return = true; self @@ -332,7 +332,7 @@ impl Builder { let params = self.generate_func_parameters(); let func = Chunk::FfiCall { name: self.glib_name.clone(), - params: params, + params, }; func } @@ -529,7 +529,7 @@ impl Builder { let val = Chunk::Custom("ret".into()); let conv = Chunk::FfiCallConversion { call: Box::new(val), - array_length_name: array_length_name, + array_length_name, ret: ret_info, }; vec.insert(0, conv); diff --git a/src/codegen/property_body.rs b/src/codegen/property_body.rs index 5988b5c52..8d88be267 100644 --- a/src/codegen/property_body.rs +++ b/src/codegen/property_body.rs @@ -90,7 +90,7 @@ impl Builder { }; let ffi_call = Chunk::FfiCall { name: self.get_ffi_func(), - params: params, + params, }; body.push(Chunk::Let { @@ -146,7 +146,7 @@ impl Builder { let ffi_call = Chunk::FfiCall { name: self.set_ffi_func(), - params: params, + params, }; let return_info = analysis::return_value::Info { parameter: None, diff --git a/src/config/child_properties.rs b/src/config/child_properties.rs index 33ecfb052..6e2fc43d1 100644 --- a/src/config/child_properties.rs +++ b/src/config/child_properties.rs @@ -45,9 +45,9 @@ impl Parse for ChildProperty { .unwrap_or(false); Some(ChildProperty { - name: name, - type_name: type_name, - doc_hidden: doc_hidden, + name, + type_name, + doc_hidden, }) } } @@ -83,9 +83,9 @@ impl Parse for ChildProperties { if !properties.is_empty() { Some(ChildProperties { - child_name: child_name, - child_type: child_type, - properties: properties, + child_name, + child_type, + properties, }) } else { if child_name.is_some() { diff --git a/src/config/constants.rs b/src/config/constants.rs index b53217d4d..2c1784686 100644 --- a/src/config/constants.rs +++ b/src/config/constants.rs @@ -41,10 +41,10 @@ impl Parse for Constant { .unwrap_or(false); Some(Constant { - ident: ident, - ignore: ignore, - version: version, - cfg_condition: cfg_condition, + ident, + ignore, + version, + cfg_condition, }) } } diff --git a/src/config/external_libraries.rs b/src/config/external_libraries.rs index db952d52a..1cbb54099 100644 --- a/src/config/external_libraries.rs +++ b/src/config/external_libraries.rs @@ -17,7 +17,7 @@ pub fn read_external_libraries(toml: &toml::Value) -> Result GObje } GObject { - name: name, - functions: functions, - constants: constants, - signals: signals, - members: members, - properties: properties, - status: status, - module_name: module_name, - version: version, - cfg_condition: cfg_condition, + name, + functions, + constants, + signals, + members, + properties, + status, + module_name, + version, + cfg_condition, type_id: None, - generate_trait: generate_trait, - trait_name: trait_name, - child_properties: child_properties, - concurrency: concurrency, - ref_mode: ref_mode, - must_use: must_use, - conversion_type: conversion_type, - use_boxed_functions: use_boxed_functions, + generate_trait, + trait_name, + child_properties, + concurrency, + ref_mode, + must_use, + conversion_type, + use_boxed_functions, } } @@ -299,8 +299,8 @@ fn parse_status_shorthand( name_.into(), GObject { name: name_.into(), - status: status, - concurrency: concurrency, + status, + concurrency, ..Default::default() }, ); diff --git a/src/config/members.rs b/src/config/members.rs index 82f383eaf..a63ab82b4 100644 --- a/src/config/members.rs +++ b/src/config/members.rs @@ -48,11 +48,11 @@ impl Parse for Member { .unwrap_or(false); Some(Member { - ident: ident, - alias: alias, - version: version, - deprecated_version: deprecated_version, - ignore: ignore, + ident, + alias, + version, + deprecated_version, + ignore, }) } } diff --git a/src/config/properties.rs b/src/config/properties.rs index c48e3cc80..1a06efe37 100644 --- a/src/config/properties.rs +++ b/src/config/properties.rs @@ -40,9 +40,9 @@ impl Parse for Property { .and_then(|s| s.parse().ok()); Some(Property { - ident: ident, - ignore: ignore, - version: version, + ident, + ignore, + version, }) } } diff --git a/src/config/signals.rs b/src/config/signals.rs index bed215e77..0c207c725 100644 --- a/src/config/signals.rs +++ b/src/config/signals.rs @@ -73,10 +73,10 @@ impl Parse for Parameter { .map(|s| s.to_owned()); Some(Parameter { - ident: ident, - nullable: nullable, - transformation: transformation, - new_name: new_name, + ident, + nullable, + transformation, + new_name, }) } } @@ -157,14 +157,14 @@ impl Signal { .unwrap_or(false); Some(Signal { - ident: ident, - ignore: ignore, - inhibit: inhibit, - version: version, - parameters: parameters, - ret: ret, - concurrency: concurrency, - doc_hidden: doc_hidden, + ident, + ignore, + inhibit, + version, + parameters, + ret, + concurrency, + doc_hidden, }) } } diff --git a/src/custom_type_glib_priority.rs b/src/custom_type_glib_priority.rs index 617c8ccf5..5b019e0d6 100644 --- a/src/custom_type_glib_priority.rs +++ b/src/custom_type_glib_priority.rs @@ -44,7 +44,7 @@ impl FunctionsMutVisitor for ReplaceToPriority { if !func.name.ends_with("_async") { return true; } - for par in func.parameters.iter_mut() { + for par in &mut func.parameters { if par.typ == self.tid_int && par.name.ends_with("priority") { par.typ = self.tid_priority; } diff --git a/src/library.rs b/src/library.rs index 3166f6ae8..f5f4e01d7 100644 --- a/src/library.rs +++ b/src/library.rs @@ -805,7 +805,7 @@ impl Library { pub fn add_type(&mut self, ns_id: u16, name: &str, typ: Type) -> TypeId { TypeId { - ns_id: ns_id, + ns_id, id: self.namespace_mut(ns_id).add_type(name, Some(typ)), } } @@ -820,20 +820,20 @@ impl Library { self.find_namespace(ns).and_then(|ns_id| { self.namespace(ns_id).find_type(name).map(|id| { TypeId { - ns_id: ns_id, - id: id, + ns_id, + id, } }) }) } else if let Some(id) = self.namespace(current_ns_id).find_type(name) { Some(TypeId { ns_id: current_ns_id, - id: id, + id, }) } else if let Some(id) = self.namespace(INTERNAL_NAMESPACE).find_type(name) { Some(TypeId { ns_id: INTERNAL_NAMESPACE, - id: id, + id, }) } else { None @@ -854,15 +854,15 @@ impl Library { let id = ns.find_type(name) .unwrap_or_else(|| ns.add_type(name, None)); return TypeId { - ns_id: ns_id, - id: id, + ns_id, + id, }; } let id = self.namespace_mut(current_ns_id).add_type(name, None); TypeId { ns_id: current_ns_id, - id: id, + id, } } @@ -896,8 +896,8 @@ impl Library { Box::new(ns.index.values().map(move |&id| { ( TypeId { - ns_id: ns_id, - id: id, + ns_id, + id, }, ns.types[id as usize].as_ref().unwrap(), ) diff --git a/src/main.rs b/src/main.rs index 5d532aa45..c4cea94ec 100644 --- a/src/main.rs +++ b/src/main.rs @@ -134,11 +134,11 @@ fn do_main() -> Result<()> { let class_hierarchy = analysis::class_hierarchy::run(&library); env = Env { - library: library, + library, config: cfg, - namespaces: namespaces, + namespaces, symbols: RefCell::new(symbols), - class_hierarchy: class_hierarchy, + class_hierarchy, analysis: Default::default(), }; } diff --git a/src/parser.rs b/src/parser.rs index e8f9c009a..d8cb0c658 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -177,18 +177,18 @@ impl Library { let typ = Type::Class(Class { name: class_name.into(), c_type: c_type.into(), - type_struct: type_struct, + type_struct, c_class_type: None, // this will be resolved during postprocessing glib_get_type: get_type.into(), - fields: fields, + fields, functions: fns, - signals: signals, - properties: properties, - parent: parent, + signals, + properties, + parent, implements: impls, - doc: doc, - version: version, - deprecated_version: deprecated_version, + doc, + version, + deprecated_version, }); self.add_type(ns_id, class_name, typ); Ok(()) @@ -305,13 +305,13 @@ impl Library { c_type: c_type.into(), glib_get_type: get_type, gtype_struct_for: gtype_struct_for.map(|s| s.into()), - fields: fields, + fields, functions: fns, - version: version, - deprecated_version: deprecated_version, - doc: doc, - doc_deprecated: doc_deprecated, - disguised: disguised, + version, + deprecated_version, + doc, + doc_deprecated, + disguised, }); Ok(Some(typ)) @@ -435,9 +435,9 @@ impl Library { name: union_name.into(), c_type: Some(c_type.into()), glib_get_type: get_type, - fields: fields, + fields, functions: fns, - doc: doc, + doc, }) } @@ -474,11 +474,11 @@ impl Library { Ok(Field { name: field_name.into(), typ: tid, - c_type: c_type, - private: private, - bits: bits, - array_length: array_length, - doc: doc, + c_type, + private, + bits, + array_length, + doc, }) } else { Err(parser.fail("Missing element")) @@ -545,16 +545,16 @@ impl Library { let typ = Type::Interface(Interface { name: interface_name.into(), c_type: c_type.into(), - type_struct: type_struct, + type_struct, c_class_type: None, // this will be resolved during postprocessing glib_get_type: get_type.into(), functions: fns, - signals: signals, - properties: properties, + signals, + properties, prerequisites: prereqs, - doc: doc, - version: version, - deprecated_version: deprecated_version, + doc, + version, + deprecated_version, }); self.add_type(ns_id, interface_name, typ); Ok(()) @@ -585,12 +585,12 @@ impl Library { let typ = Type::Bitfield(Bitfield { name: bitfield_name.into(), c_type: c_type.into(), - members: members, + members, functions: fns, - version: version, - deprecated_version: deprecated_version, - doc: doc, - doc_deprecated: doc_deprecated, + version, + deprecated_version, + doc, + doc_deprecated, glib_get_type: get_type, }); self.add_type(ns_id, bitfield_name, typ); @@ -632,13 +632,13 @@ impl Library { let typ = Type::Enumeration(Enumeration { name: enum_name.into(), c_type: c_type.into(), - members: members, + members, functions: fns, - version: version, - deprecated_version: deprecated_version, - doc: doc, - doc_deprecated: doc_deprecated, - error_domain: error_domain, + version, + deprecated_version, + doc, + doc_deprecated, + error_domain, glib_get_type: get_type, }); self.add_type(ns_id, enum_name, typ); @@ -703,13 +703,13 @@ impl Library { Constant { name: const_name.into(), c_identifier: c_identifier.into(), - typ: typ, - c_type: c_type, + typ, + c_type, value: value.into(), - version: version, - deprecated_version: deprecated_version, - doc: doc, - doc_deprecated: doc_deprecated, + version, + deprecated_version, + doc, + doc_deprecated, }, ); Ok(()) @@ -746,9 +746,9 @@ impl Library { let typ = Type::Alias(Alias { name: alias_name.into(), c_identifier: c_identifier.into(), - typ: typ, + typ, target_c_type: c_type, - doc: doc, + doc, }); self.add_type(ns_id, alias_name, typ); Ok(()) @@ -772,7 +772,7 @@ impl Library { Ok(Member { name: member_name.into(), value: value.into(), - doc: doc, + doc, c_identifier: c_identifier.unwrap_or_else(|| member_name.into()), }) } @@ -843,14 +843,14 @@ impl Library { Ok(Function { name: fn_name.into(), c_identifier: c_identifier.map(|s| s.into()), - kind: kind, + kind, parameters: params, - ret: ret, - throws: throws, - version: version, - deprecated_version: deprecated_version, - doc: doc, - doc_deprecated: doc_deprecated, + ret, + throws, + version, + deprecated_version, + doc, + doc_deprecated, }) } else { Err(parser.fail("Missing element")) @@ -926,12 +926,12 @@ impl Library { Ok(Signal { name: signal_name.into(), parameters: params, - ret: ret, - is_action: is_action, - version: version, - deprecated_version: deprecated_version, - doc: doc, - doc_deprecated: doc_deprecated, + ret, + is_action, + version, + deprecated_version, + doc, + doc_deprecated, }) } else { Err(parser.fail("Missing element")) @@ -1017,15 +1017,15 @@ impl Library { name: param_name.into(), typ: tid, c_type: c_type.unwrap(), - instance_parameter: instance_parameter, - direction: direction, - transfer: transfer, - caller_allocates: caller_allocates, + instance_parameter, + direction, + transfer, + caller_allocates, nullable: Nullable(nullable), - allow_none: allow_none, - array_length: array_length, + allow_none, + array_length, is_error: false, - doc: doc, + doc, async, }) } else if varargs { @@ -1033,15 +1033,15 @@ impl Library { name: "".into(), typ: self.find_type(INTERNAL_NAMESPACE, "varargs").unwrap(), c_type: "".into(), - instance_parameter: instance_parameter, + instance_parameter, direction: Default::default(), transfer: Transfer::None, caller_allocates: false, nullable: Nullable(false), - allow_none: allow_none, + allow_none, array_length: None, is_error: false, - doc: doc, + doc, async, }) } else { @@ -1098,17 +1098,17 @@ impl Library { if let Some((tid, c_type, _array_length)) = typ { Ok(Some(Property { name: prop_name.into(), - readable: readable, - writable: writable, - construct: construct, - construct_only: construct_only, - transfer: transfer, + readable, + writable, + construct, + construct_only, + transfer, typ: tid, - c_type: c_type, - version: version, - deprecated_version: deprecated_version, - doc: doc, - doc_deprecated: doc_deprecated, + c_type, + version, + deprecated_version, + doc, + doc_deprecated, })) } else { Err(parser.fail("Missing element")) diff --git a/src/visitors.rs b/src/visitors.rs index ead37f112..0cb165043 100644 --- a/src/visitors.rs +++ b/src/visitors.rs @@ -8,7 +8,7 @@ pub trait FunctionsMutVisitor { impl Namespace { pub fn visit_functions_mut(&mut self, visitor: &mut V) -> bool { - for type_ in self.types.iter_mut() { + for type_ in &mut self.types { if let Some(ref mut type_) = *type_ { if !type_.visit_functions_mut(visitor) { return false; @@ -22,17 +22,17 @@ impl Namespace { impl Type { pub fn visit_functions_mut(&mut self, visitor: &mut V) -> bool { match *self { - Type::Class(ref mut class) => for function in class.functions.iter_mut() { + Type::Class(ref mut class) => for function in &mut class.functions { if !visitor.visit_function_mut(function) { return false; } }, - Type::Interface(ref mut interface) => for function in interface.functions.iter_mut() { + Type::Interface(ref mut interface) => for function in &mut interface.functions { if !visitor.visit_function_mut(function) { return false; } }, - Type::Record(ref mut record) => for function in record.functions.iter_mut() { + Type::Record(ref mut record) => for function in &mut record.functions { if !visitor.visit_function_mut(function) { return false; } diff --git a/src/writer/untabber.rs b/src/writer/untabber.rs index 42793d465..7a93d1ffc 100644 --- a/src/writer/untabber.rs +++ b/src/writer/untabber.rs @@ -7,7 +7,7 @@ pub struct Untabber { impl Untabber { pub fn new(orig: Box) -> Untabber { - Untabber { orig: orig } + Untabber { orig } } }