Closed NextThread closed 1 day ago
Looks like a couple of things to address with the pre-commit.
You can run with either:
make pre-commit
or
pre-commit run --all-files
You can also install the git hook with:
pre-commit install
Here's some of the CI output if it helps:
error[E0599]: no method named `clone` found for struct `std::sync::atomic::AtomicBool` in the current scope
Error: --> network/src/socket.rs:322:29
|
322 | disconnect_mode.clone(),
| ^^^^^ method not found in `AtomicBool`
error[E0599]: no method named `clone` found for struct `std::sync::atomic::AtomicBool` in the current scope
Error: --> network/src/websocket.rs:345:29
|
345 | disconnect_mode.clone(),
| ^^^^^ method not found in `AtomicBool`
error[E0599]: no method named `lock` found for struct `std::sync::atomic::AtomicBool` in the current scope
Error: --> network/src/socket.rs:373:45
|
373 | let guard = disconnect_mode.lock().await;
| ^^^^ method not found in `AtomicBool`
error[E0599]: no method named `lock` found for struct `std::sync::atomic::AtomicBool` in the current scope
Error: --> network/src/websocket.rs:404:45
|
404 | let guard = disconnect_mode.lock().await;
| ^^^^ method not found in `AtomicBool`
error[E0597]: `slf` does not live long enough
Error: --> network/src/socket.rs:459:32
|
458 | fn py_disconnect<'py>(slf: PyRef<'_, Self>, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
| --- binding `slf` declared here
459 | let disconnect_mode = &slf.disconnect_mode;
| ^^^ borrowed value does not live long enough
...
462 | / pyo3_asyncio_0_21::tokio::future_into_py(py, async move {
463 | | disconnect_mode.store(true, Ordering::SeqCst);
464 | | Ok(())
465 | | })
| |__________- argument requires that `slf` is borrowed for `'static`
466 | }
| - `slf` dropped here while still borrowed
error[E0521]: borrowed data escapes outside of associated function
Error: --> network/src/socket.rs:462:9
|
458 | fn py_disconnect<'py>(slf: PyRef<'_, Self>, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
| ---
| |
| `slf` is a reference that is only valid in the associated function body
| has type `pyo3::PyRef<'1, socket::SocketClient>`
...
462 | / pyo3_asyncio_0_21::tokio::future_into_py(py, async move {
463 | | disconnect_mode.store(true, Ordering::SeqCst);
464 | | Ok(())
465 | | })
| | ^
| | |
| |__________`slf` escapes the associated function body here
| argument requires that `'1` must outlive `'static`
error[E0597]: `slf` does not live long enough
Error: --> network/src/websocket.rs:501:32
|
500 | fn py_disconnect<'py>(slf: PyRef<'_, Self>, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
| --- binding `slf` declared here
501 | let disconnect_mode = &slf.disconnect_mode;
| ^^^ borrowed value does not live long enough
502 | / pyo3_asyncio_0_21::tokio::future_into_py(py, async move {
503 | | disconnect_mode.store(true, Ordering::SeqCst);
504 | | Ok(())
505 | | })
| |__________- argument requires that `slf` is borrowed for `'static`
506 | }
| - `slf` dropped here while still borrowed
error[E0521]: borrowed data escapes outside of associated function
Error: --> network/src/websocket.rs:502:9
|
500 | fn py_disconnect<'py>(slf: PyRef<'_, Self>, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
| ---
| |
| `slf` is a reference that is only valid in the associated function body
| has type `pyo3::PyRef<'1, websocket::WebSocketClient>`
501 | let disconnect_mode = &slf.disconnect_mode;
502 | / pyo3_asyncio_0_21::tokio::future_into_py(py, async move {
503 | | disconnect_mode.store(true, Ordering::SeqCst);
504 | | Ok(())
505 | | })
| | ^
| | |
| |__________`slf` escapes the associated function body here
| argument requires that `'1` must outlive `'static`
Some errors have detailed explanations: E0521, E0597, E0599.
For more information about an error, try `rustc --explain E0521`.
error: could not compile `nautilus-network` (lib) due to 8 previous errors
warning: build failed, waiting for other jobs to finish...
Looks like there's a formatting difference with the imports.
I'll just merge as is and fix on develop
.
Running this would fix it though (with the nightly toolchain installed because this style of import sorting still hasn't been stabilized):
make format
Pull Request
Include a summary of the changes. Fixes #1732 : Network clients can use AtomicBool instead of <Arc<Mutex>
Type of change
Delete options that are not relevant.
How has this change been tested?
make pre-commit
Describe how this code was/is tested.