diff --git a/actix-codec/src/lib.rs b/actix-codec/src/lib.rs index 24628e79..9e875409 100644 --- a/actix-codec/src/lib.rs +++ b/actix-codec/src/lib.rs @@ -4,8 +4,6 @@ //! [`AsyncWrite`], to framed streams implementing [`Sink`] and [`Stream`]. //! Framed streams are also known as `transports`. //! -//! [`AsyncRead`]: AsyncRead -//! [`AsyncWrite`]: AsyncWrite //! [`Sink`]: futures_sink::Sink //! [`Stream`]: futures_core::Stream diff --git a/actix-connect/src/connect.rs b/actix-connect/src/connect.rs index 7d5531e5..37fa9c6e 100644 --- a/actix-connect/src/connect.rs +++ b/actix-connect/src/connect.rs @@ -138,7 +138,7 @@ impl fmt::Display for Connect { } } -/// Iterator over addresses in a [`Connect`](struct.Connect.html) request. +/// Iterator over addresses in a [`Connect`] request. #[derive(Clone)] pub struct ConnectAddrsIter<'a> { inner: Either, vec_deque::Iter<'a, SocketAddr>>, @@ -173,7 +173,7 @@ impl ExactSizeIterator for ConnectAddrsIter<'_> {} impl FusedIterator for ConnectAddrsIter<'_> {} -/// Owned iterator over addresses in a [`Connect`](struct.Connect.html) request. +/// Owned iterator over addresses in a [`Connect`] request. #[derive(Debug)] pub struct ConnectTakeAddrsIter { inner: Either, vec_deque::IntoIter>, diff --git a/actix-rt/src/arbiter.rs b/actix-rt/src/arbiter.rs index f049f98f..24d3d125 100644 --- a/actix-rt/src/arbiter.rs +++ b/actix-rt/src/arbiter.rs @@ -333,7 +333,7 @@ impl Future for CleanupPending { let mut pending = cell.borrow_mut(); let mut i = 0; while i != pending.len() { - if let Poll::Ready(_) = Pin::new(&mut pending[i]).poll(cx) { + if Pin::new(&mut pending[i]).poll(cx).is_ready() { pending.remove(i); } else { i += 1; diff --git a/actix-rt/src/runtime.rs b/actix-rt/src/runtime.rs index 8c15e799..c19aa2b7 100644 --- a/actix-rt/src/runtime.rs +++ b/actix-rt/src/runtime.rs @@ -7,7 +7,7 @@ use tokio::{runtime, task::LocalSet}; /// /// See [module level][mod] documentation for more details. /// -/// [mod]: index.html +/// [mod]: crate #[derive(Debug)] pub struct Runtime { local: LocalSet, @@ -33,7 +33,7 @@ impl Runtime { /// /// See [module level][mod] documentation for more details. /// - /// [mod]: index.html + /// [mod]: crate /// /// # Examples /// diff --git a/actix-rt/src/system.rs b/actix-rt/src/system.rs index 0ead516d..07e0575c 100644 --- a/actix-rt/src/system.rs +++ b/actix-rt/src/system.rs @@ -66,7 +66,6 @@ impl System { /// It means that using this method currently it is impossible to make `actix-rt` work in the /// alternative `tokio` `Runtime`s (e.g. provided by [`tokio_compat`]). /// - /// [`Arbiter`]: struct.Arbiter.html /// [`tokio_compat`]: https://crates.io/crates/tokio-compat /// /// # Examples @@ -130,7 +129,6 @@ impl System { /// It means that using this method currently it is impossible to make `actix-rt` work in the /// alternative `tokio` `Runtime`s (e.g. provided by `tokio_compat`). /// - /// [`Arbiter`]: struct.Arbiter.html /// [`tokio_compat`]: https://crates.io/crates/tokio-compat /// /// # Arguments diff --git a/actix-server/src/signals.rs b/actix-server/src/signals.rs index 6a0d7da9..b0462b13 100644 --- a/actix-server/src/signals.rs +++ b/actix-server/src/signals.rs @@ -58,7 +58,7 @@ impl Signals { ), } } - + actix_rt::spawn(Signals { srv, streams }); } } diff --git a/actix-service/src/lib.rs b/actix-service/src/lib.rs index b25a6f98..96c878e3 100644 --- a/actix-service/src/lib.rs +++ b/actix-service/src/lib.rs @@ -1,4 +1,4 @@ -//! See [`Service`](trait.Service.html) docs for information on this crate's foundational trait. +//! See [`Service`] docs for information on this crate's foundational trait. #![deny(rust_2018_idioms, nonstandard_style)] #![allow(clippy::type_complexity)] @@ -67,7 +67,7 @@ pub use self::transform::{apply, Transform}; /// ``` /// /// Sometimes it is not necessary to implement the Service trait. For example, the above service -/// could be rewritten as a simple function and passed to [fn_service](fn.fn_service.html). +/// could be rewritten as a simple function and passed to [fn_service](fn_service()). /// /// ```rust,ignore /// async fn my_service(req: u8) -> Result; diff --git a/actix-tracing/src/lib.rs b/actix-tracing/src/lib.rs index c011790b..b61ffac8 100644 --- a/actix-tracing/src/lib.rs +++ b/actix-tracing/src/lib.rs @@ -60,8 +60,6 @@ where } /// A `Transform` implementation that wraps services with a [`TracingService`]. -/// -/// [`TracingService`]: struct.TracingService.html pub struct TracingTransform { make_span: F, _p: PhantomData, diff --git a/actix-utils/src/dispatcher.rs b/actix-utils/src/dispatcher.rs index 15d3ccf7..1ee72564 100644 --- a/actix-utils/src/dispatcher.rs +++ b/actix-utils/src/dispatcher.rs @@ -290,10 +290,8 @@ where } State::Error(_) => { // flush write buffer - if !this.framed.is_write_buf_empty() { - if let Poll::Pending = this.framed.flush(cx) { - return Poll::Pending; - } + if !this.framed.is_write_buf_empty() && this.framed.flush(cx).is_pending() { + return Poll::Pending; } Poll::Ready(Err(this.state.take_error())) } diff --git a/actix-utils/src/inflight.rs b/actix-utils/src/inflight.rs index 21fff5e3..2207f82a 100644 --- a/actix-utils/src/inflight.rs +++ b/actix-utils/src/inflight.rs @@ -74,7 +74,7 @@ where type Future = InFlightServiceResponse; fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll> { - if let Poll::Pending = self.service.poll_ready(cx)? { + if self.service.poll_ready(cx)?.is_pending() { Poll::Pending } else if !self.count.available(cx) { log::trace!("InFlight limit exceeded"); diff --git a/actix-utils/src/order.rs b/actix-utils/src/order.rs index 15de0fee..6d79ae4c 100644 --- a/actix-utils/src/order.rs +++ b/actix-utils/src/order.rs @@ -160,7 +160,12 @@ where } // check nested service - if let Poll::Pending = self.service.poll_ready(cx).map_err(InOrderError::Service)? { + if self + .service + .poll_ready(cx) + .map_err(InOrderError::Service)? + .is_pending() + { Poll::Pending } else { Poll::Ready(Ok(())) diff --git a/actix-utils/src/task.rs b/actix-utils/src/task.rs index dca386b8..cb32eb8d 100644 --- a/actix-utils/src/task.rs +++ b/actix-utils/src/task.rs @@ -19,6 +19,7 @@ use std::{fmt, rc}; /// /// A single `AtomicWaker` may be reused for any number of calls to `register` or /// `wake`. +// TODO: Refactor to Cell when remove deprecated methods (@botika) #[derive(Default)] pub struct LocalWaker { pub(crate) waker: UnsafeCell>, @@ -34,6 +35,10 @@ impl LocalWaker { } } + #[deprecated( + since = "2.1.0", + note = "In favor of `wake`. State of the register doesn't matter at `wake` up" + )] #[inline] /// Check if waker has been registered. pub fn is_registered(&self) -> bool { @@ -47,9 +52,8 @@ impl LocalWaker { pub fn register(&self, waker: &Waker) -> bool { unsafe { let w = self.waker.get(); - let is_registered = (*w).is_some(); - *w = Some(waker.clone()); - is_registered + let last_waker = w.replace(Some(waker.clone())); + last_waker.is_some() } } @@ -63,6 +67,7 @@ impl LocalWaker { } } + #[inline] /// Returns the last `Waker` passed to `register`, so that the user can wake it. /// /// If a waker has not been registered, this returns `None`. diff --git a/string/src/lib.rs b/string/src/lib.rs index 553c8634..18cbc890 100644 --- a/string/src/lib.rs +++ b/string/src/lib.rs @@ -11,7 +11,7 @@ use bytes::Bytes; /// A UTF-8 encoded string with [`Bytes`] as a storage. /// -/// [`Bytes`]: https://docs.rs/bytes/0.5.3/bytes/struct.Bytes.html +/// [`Bytes`]: bytes::Bytes #[derive(Clone, Eq, Ord, PartialOrd, Default)] pub struct ByteString(Bytes);