From 42e0307cc295baa8853669e1dc1e7e266fdcb72a Mon Sep 17 00:00:00 2001 From: Ellen Arteca Date: Fri, 1 Nov 2024 17:35:57 -0700 Subject: [PATCH] cleanup --- .../src/main/kotlin/dev/diplomattest/somelib/DataProvider.kt | 1 - .../src/main/kotlin/dev/diplomattest/somelib/FixedDecimal.kt | 1 - .../kotlin/dev/diplomattest/somelib/FixedDecimalFormatter.kt | 1 - .../somelib/src/main/kotlin/dev/diplomattest/somelib/Locale.kt | 1 - .../src/main/kotlin/dev/diplomattest/somelib/TesterTrait.kt | 1 + tool/src/kotlin/formatter.rs | 2 +- tool/src/kotlin/mod.rs | 2 +- tool/templates/kotlin/Trait.kt.jinja | 1 - 8 files changed, 3 insertions(+), 7 deletions(-) diff --git a/example/kotlin/somelib/src/main/kotlin/dev/diplomattest/somelib/DataProvider.kt b/example/kotlin/somelib/src/main/kotlin/dev/diplomattest/somelib/DataProvider.kt index 072074fc4..9e132c2b1 100644 --- a/example/kotlin/somelib/src/main/kotlin/dev/diplomattest/somelib/DataProvider.kt +++ b/example/kotlin/somelib/src/main/kotlin/dev/diplomattest/somelib/DataProvider.kt @@ -15,7 +15,6 @@ internal interface DataProviderLib: Library { * *See the [Rust documentation for `icu_provider`](https://docs.rs/icu_provider/latest/icu_provider/index.html) for more information. */ - class DataProvider internal constructor ( internal val handle: Pointer, // These ensure that anything that is borrowed is kept alive and not cleaned diff --git a/example/kotlin/somelib/src/main/kotlin/dev/diplomattest/somelib/FixedDecimal.kt b/example/kotlin/somelib/src/main/kotlin/dev/diplomattest/somelib/FixedDecimal.kt index 66cde9766..dd8800a52 100644 --- a/example/kotlin/somelib/src/main/kotlin/dev/diplomattest/somelib/FixedDecimal.kt +++ b/example/kotlin/somelib/src/main/kotlin/dev/diplomattest/somelib/FixedDecimal.kt @@ -14,7 +14,6 @@ internal interface FixedDecimalLib: Library { } /** See the [Rust documentation for `FixedDecimal`](https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html) for more information. */ - class FixedDecimal internal constructor ( internal val handle: Pointer, // These ensure that anything that is borrowed is kept alive and not cleaned diff --git a/example/kotlin/somelib/src/main/kotlin/dev/diplomattest/somelib/FixedDecimalFormatter.kt b/example/kotlin/somelib/src/main/kotlin/dev/diplomattest/somelib/FixedDecimalFormatter.kt index 278191d3c..fa8a0a961 100644 --- a/example/kotlin/somelib/src/main/kotlin/dev/diplomattest/somelib/FixedDecimalFormatter.kt +++ b/example/kotlin/somelib/src/main/kotlin/dev/diplomattest/somelib/FixedDecimalFormatter.kt @@ -15,7 +15,6 @@ internal interface FixedDecimalFormatterLib: Library { * *See the [Rust documentation for `FixedDecimalFormatter`](https://docs.rs/icu/latest/icu/decimal/struct.FixedDecimalFormatter.html) for more information. */ - class FixedDecimalFormatter internal constructor ( internal val handle: Pointer, // These ensure that anything that is borrowed is kept alive and not cleaned diff --git a/example/kotlin/somelib/src/main/kotlin/dev/diplomattest/somelib/Locale.kt b/example/kotlin/somelib/src/main/kotlin/dev/diplomattest/somelib/Locale.kt index 7850509aa..9fac83be9 100644 --- a/example/kotlin/somelib/src/main/kotlin/dev/diplomattest/somelib/Locale.kt +++ b/example/kotlin/somelib/src/main/kotlin/dev/diplomattest/somelib/Locale.kt @@ -14,7 +14,6 @@ internal interface LocaleLib: Library { * *See the [Rust documentation for `Locale`](https://docs.rs/icu/latest/icu/locid/struct.Locale.html) for more information. */ - class Locale internal constructor ( internal val handle: Pointer, // These ensure that anything that is borrowed is kept alive and not cleaned diff --git a/feature_tests/kotlin/somelib/src/main/kotlin/dev/diplomattest/somelib/TesterTrait.kt b/feature_tests/kotlin/somelib/src/main/kotlin/dev/diplomattest/somelib/TesterTrait.kt index 870c1d9e7..cd8ff0ea1 100644 --- a/feature_tests/kotlin/somelib/src/main/kotlin/dev/diplomattest/somelib/TesterTrait.kt +++ b/feature_tests/kotlin/somelib/src/main/kotlin/dev/diplomattest/somelib/TesterTrait.kt @@ -5,6 +5,7 @@ import com.sun.jna.Library import com.sun.jna.Native import com.sun.jna.Pointer import com.sun.jna.Structure + interface TesterTrait { fun testTraitFn(x: Int): Int; fun testVoidTraitFn(): Unit; diff --git a/tool/src/kotlin/formatter.rs b/tool/src/kotlin/formatter.rs index 7c2912b77..58fdb3d6d 100644 --- a/tool/src/kotlin/formatter.rs +++ b/tool/src/kotlin/formatter.rs @@ -470,7 +470,7 @@ pub mod test { let tcx = new_tcx(tk_stream); let docs_urls = std::collections::HashMap::new(); let docs_generator = &diplomat_core::hir::DocsUrlGenerator::with_base_urls(None, docs_urls); - let formatter = KotlinFormatter::new(&tcx, None, &docs_generator); + let formatter = KotlinFormatter::new(&tcx, None, docs_generator); let opaques = tcx.opaques(); assert!(!opaques.is_empty()); let mut all_types = tcx.all_types(); diff --git a/tool/src/kotlin/mod.rs b/tool/src/kotlin/mod.rs index 7f4ab02c3..74e942d39 100644 --- a/tool/src/kotlin/mod.rs +++ b/tool/src/kotlin/mod.rs @@ -1586,7 +1586,7 @@ returnVal.option() ?: return null non_native_params_and_types, input_params: native_input_names.join(", "), docs: match &method.docs { - Some(method_docs) => self.formatter.fmt_docs(&method_docs), + Some(method_docs) => self.formatter.fmt_docs(method_docs), None => "".to_string(), }, } diff --git a/tool/templates/kotlin/Trait.kt.jinja b/tool/templates/kotlin/Trait.kt.jinja index 8c0ea31fe..a98b2670f 100644 --- a/tool/templates/kotlin/Trait.kt.jinja +++ b/tool/templates/kotlin/Trait.kt.jinja @@ -5,7 +5,6 @@ import com.sun.jna.Library import com.sun.jna.Native import com.sun.jna.Pointer import com.sun.jna.Structure - {% if !docs.is_empty() -%} /** {{docs}} */