Skip to content

Commit 56629c3

Browse files
authored
fix: make build process clear (#20)
1 parent 1416f54 commit 56629c3

File tree

6 files changed

+15
-12
lines changed

6 files changed

+15
-12
lines changed

cxx-async/include/rust/cxx_async.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ inline bool RustStreamAwaiter<Future>::await_suspend(
886886
std_coroutine::coroutine_handle<void> next) {
887887
SuspendedCoroutine* coroutine = new SuspendedCoroutine(
888888
std::make_unique<CoroutineHandleContinuation>(std::move(next)),
889-
[=](SuspendedCoroutine* coroutine) {
889+
[this](SuspendedCoroutine* coroutine) {
890890
return this->poll_next(coroutine);
891891
});
892892
return coroutine->initial_suspend();

cxx-async/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -852,8 +852,7 @@ where
852852
Err(error) => {
853853
drop(writeln!(
854854
io::stderr(),
855-
"Rust async code panicked when awaited from C++: {:?}",
856-
error
855+
"Rust async code panicked when awaited from C++: {error:?}"
857856
));
858857
process::abort();
859858
}

examples/cppcoro/build.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ fn main() {
1111

1212
cxx_build::bridge("src/main.rs")
1313
.file("src/cppcoro_example.cpp")
14-
.flag("-std=c++20")
14+
.flag_if_supported("-std=c++20")
15+
.flag_if_supported("-Wno-ignored-qualifiers")
1516
.flag_if_supported("-Wall")
1617
.include("include")
1718
.include("../common/include")

examples/cppcoro/src/main.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ use async_recursion::async_recursion;
77
use cxx_async::CxxAsyncException;
88
use futures::executor::{self, ThreadPool};
99
use futures::task::SpawnExt;
10-
use futures::{join, Stream};
11-
use futures::{StreamExt, TryStreamExt};
10+
use futures::{join, Stream, StreamExt};
1211
use once_cell::sync::Lazy;
1312
use std::future::Future;
1413
use std::ops::Range;
@@ -271,6 +270,8 @@ fn test_indirect_fizzbuzz() {
271270

272271
#[test]
273272
fn test_streams_throwing_exceptions() {
273+
use futures::TryStreamExt;
274+
274275
let mut vector = executor::block_on(
275276
ffi::cppcoro_not_fizzbuzz()
276277
.map_err(|err| err.what().to_owned())
@@ -347,12 +348,12 @@ fn main() {
347348
// Test Rust calling C++ streams that throw exceptions partway through.
348349
let vector = executor::block_on(
349350
ffi::cppcoro_not_fizzbuzz()
350-
.map(|result| format!("{:?}", result))
351+
.map(|result| format!("{result:?}"))
351352
.collect::<Vec<String>>(),
352353
);
353354
println!("{}", vector.join(", "));
354355

355356
// Test that destructors are called when dropping a future.
356-
let _ = ffi::cppcoro_drop_coroutine_wait();
357+
ffi::cppcoro_drop_coroutine_wait();
357358
drop(executor::block_on(ffi::cppcoro_drop_coroutine_signal()));
358359
}

examples/folly/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ fn main() {
1616
.include("../../cxx-async/include")
1717
.includes(&folly.include_paths);
1818
build.flag("-std=c++20");
19+
build.flag("-Wno-ignored-qualifiers");
1920

2021
for other_cflag in &folly.other_cflags {
2122
build.flag(other_cflag);

examples/folly/src/main.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ use async_recursion::async_recursion;
77
use cxx_async::CxxAsyncException;
88
use futures::executor::{self, ThreadPool};
99
use futures::task::SpawnExt;
10-
use futures::{join, Stream};
11-
use futures::{StreamExt, TryStreamExt};
10+
use futures::{join, Stream, StreamExt};
1211
use once_cell::sync::Lazy;
1312
use std::future::Future;
1413
use std::ops::Range;
@@ -282,6 +281,8 @@ fn test_indirect_fizzbuzz() {
282281

283282
#[test]
284283
fn test_streams_throwing_exceptions() {
284+
use futures::TryStreamExt;
285+
285286
let mut vector = executor::block_on(
286287
ffi::folly_not_fizzbuzz()
287288
.map_err(|err| err.what().to_owned())
@@ -360,12 +361,12 @@ fn main() {
360361
// Test Rust calling C++ streams that throw exceptions partway through.
361362
let vector = executor::block_on(
362363
ffi::folly_not_fizzbuzz()
363-
.map(|result| format!("{:?}", result))
364+
.map(|result| format!("{result:?}"))
364365
.collect::<Vec<String>>(),
365366
);
366367
println!("{}", vector.join(", "));
367368

368369
// Test that destructors are called when dropping a future.
369-
let _ = ffi::folly_drop_coroutine_wait();
370+
ffi::folly_drop_coroutine_wait();
370371
drop(executor::block_on(ffi::folly_drop_coroutine_signal()));
371372
}

0 commit comments

Comments
 (0)