summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-11-13 14:13:24 +0800
committerruki <[email protected]>2021-11-13 14:13:24 +0800
commitf500e8b44d60c9f94fde6d99027a992d1b85e367 (patch)
tree77a20f28cd09d6433acd6b86176222536e1fa13a
parentc25ecb6bccb5046496d6990f3e4ce3ed64748408 (diff)
improve rust tests
-rw-r--r--tests/projects/rust/console/src/main.rs3
-rw-r--r--tests/projects/rust/cxx_call_rust_library/src/main.cc3
-rw-r--r--tests/projects/rust/rust_call_cxx_library/src/foo.cc3
-rw-r--r--tests/projects/rust/shared_library/src/foo.rs3
-rw-r--r--tests/projects/rust/shared_library/src/main.rs3
-rw-r--r--tests/projects/rust/static_library/src/foo.rs3
-rw-r--r--tests/projects/rust/static_library/src/main.rs4
-rw-r--r--xmake/templates/rust/console/project/src/main.rs3
-rw-r--r--xmake/templates/rust/static/project/src/foo.rs3
-rw-r--r--xmake/templates/rust/static/project/src/main.rs3
10 files changed, 10 insertions, 21 deletions
diff --git a/tests/projects/rust/console/src/main.rs b/tests/projects/rust/console/src/main.rs
index e8d2ae9b2..88d5e2749 100644
--- a/tests/projects/rust/console/src/main.rs
+++ b/tests/projects/rust/console/src/main.rs
@@ -1,4 +1,3 @@
-fn main()
-{
+fn main() {
println!("hello xmake!");
}
diff --git a/tests/projects/rust/cxx_call_rust_library/src/main.cc b/tests/projects/rust/cxx_call_rust_library/src/main.cc
index c0d600fd3..d79b319f9 100644
--- a/tests/projects/rust/cxx_call_rust_library/src/main.cc
+++ b/tests/projects/rust/cxx_call_rust_library/src/main.cc
@@ -1,8 +1,7 @@
#include <stdio.h>
#include "bridge.rs.h"
-int main(int argc, char** argv)
-{
+int main(int argc, char** argv) {
printf("add(1, 2) == %d\n", add(1, 2));
return 0;
}
diff --git a/tests/projects/rust/rust_call_cxx_library/src/foo.cc b/tests/projects/rust/rust_call_cxx_library/src/foo.cc
index 9d989119e..bb2eb9292 100644
--- a/tests/projects/rust/rust_call_cxx_library/src/foo.cc
+++ b/tests/projects/rust/rust_call_cxx_library/src/foo.cc
@@ -1,4 +1,3 @@
-extern "C" int add(int a, int b)
-{
+extern "C" int add(int a, int b) {
return a + b;
}
diff --git a/tests/projects/rust/shared_library/src/foo.rs b/tests/projects/rust/shared_library/src/foo.rs
index 277008ba4..a3a3aa4a6 100644
--- a/tests/projects/rust/shared_library/src/foo.rs
+++ b/tests/projects/rust/shared_library/src/foo.rs
@@ -1,5 +1,4 @@
-pub fn add(a: i32, b: i32) -> i32
-{
+pub fn add(a: i32, b: i32) -> i32 {
return a + b;
}
diff --git a/tests/projects/rust/shared_library/src/main.rs b/tests/projects/rust/shared_library/src/main.rs
index 24f23d84b..205d23da3 100644
--- a/tests/projects/rust/shared_library/src/main.rs
+++ b/tests/projects/rust/shared_library/src/main.rs
@@ -1,7 +1,6 @@
extern crate foo;
-fn main()
-{
+fn main() {
println!("hello xmake!");
println!("add: {}", foo::add(1, 1));
}
diff --git a/tests/projects/rust/static_library/src/foo.rs b/tests/projects/rust/static_library/src/foo.rs
index 277008ba4..a3a3aa4a6 100644
--- a/tests/projects/rust/static_library/src/foo.rs
+++ b/tests/projects/rust/static_library/src/foo.rs
@@ -1,5 +1,4 @@
-pub fn add(a: i32, b: i32) -> i32
-{
+pub fn add(a: i32, b: i32) -> i32 {
return a + b;
}
diff --git a/tests/projects/rust/static_library/src/main.rs b/tests/projects/rust/static_library/src/main.rs
index 24f23d84b..de8604a65 100644
--- a/tests/projects/rust/static_library/src/main.rs
+++ b/tests/projects/rust/static_library/src/main.rs
@@ -1,7 +1,5 @@
extern crate foo;
-
-fn main()
-{
+fn main() {
println!("hello xmake!");
println!("add: {}", foo::add(1, 1));
}
diff --git a/xmake/templates/rust/console/project/src/main.rs b/xmake/templates/rust/console/project/src/main.rs
index fe3b8813c..88d5e2749 100644
--- a/xmake/templates/rust/console/project/src/main.rs
+++ b/xmake/templates/rust/console/project/src/main.rs
@@ -1,4 +1,3 @@
-fn main()
-{
+fn main() {
println!("hello xmake!");
}
diff --git a/xmake/templates/rust/static/project/src/foo.rs b/xmake/templates/rust/static/project/src/foo.rs
index 277008ba4..a3a3aa4a6 100644
--- a/xmake/templates/rust/static/project/src/foo.rs
+++ b/xmake/templates/rust/static/project/src/foo.rs
@@ -1,5 +1,4 @@
-pub fn add(a: i32, b: i32) -> i32
-{
+pub fn add(a: i32, b: i32) -> i32 {
return a + b;
}
diff --git a/xmake/templates/rust/static/project/src/main.rs b/xmake/templates/rust/static/project/src/main.rs
index 24f23d84b..205d23da3 100644
--- a/xmake/templates/rust/static/project/src/main.rs
+++ b/xmake/templates/rust/static/project/src/main.rs
@@ -1,7 +1,6 @@
extern crate foo;
-fn main()
-{
+fn main() {
println!("hello xmake!");
println!("add: {}", foo::add(1, 1));
}