From 4537dc26553397a4865953e46cacd6ed2ba5cfb6 Mon Sep 17 00:00:00 2001 From: Mahmoud Mazouz Date: Fri, 8 Mar 2024 14:49:19 +0100 Subject: [PATCH] fix: Resolve Nightly Rustdoc errors and warnings (#792) --- commons/zenoh-buffers/src/bbuf.rs | 5 ++++- commons/zenoh-buffers/src/vec.rs | 4 +++- commons/zenoh-collections/src/properties.rs | 1 - commons/zenoh-collections/src/single_or_vec.rs | 5 ++++- commons/zenoh-result/src/lib.rs | 3 ++- zenoh/src/info.rs | 2 +- zenoh/src/key_expr.rs | 4 ++-- zenoh/src/plugins/sealed.rs | 2 +- zenoh/src/subscriber.rs | 8 ++++---- 9 files changed, 21 insertions(+), 13 deletions(-) diff --git a/commons/zenoh-buffers/src/bbuf.rs b/commons/zenoh-buffers/src/bbuf.rs index 2f5c24d6a0..687961aa5e 100644 --- a/commons/zenoh-buffers/src/bbuf.rs +++ b/commons/zenoh-buffers/src/bbuf.rs @@ -18,9 +18,12 @@ use crate::{ writer::{BacktrackableWriter, DidntWrite, HasWriter, Writer}, ZSlice, }; -use alloc::{boxed::Box, sync::Arc}; +use alloc::sync::Arc; use core::{fmt, num::NonZeroUsize, option}; +#[cfg(not(feature = "std"))] +use alloc::boxed::Box; + #[derive(Clone, PartialEq, Eq)] pub struct BBuf { buffer: Box<[u8]>, diff --git a/commons/zenoh-buffers/src/vec.rs b/commons/zenoh-buffers/src/vec.rs index cf5a3ad9b4..bc2edf87bb 100644 --- a/commons/zenoh-buffers/src/vec.rs +++ b/commons/zenoh-buffers/src/vec.rs @@ -16,9 +16,11 @@ use crate::{ reader::HasReader, writer::{BacktrackableWriter, DidntWrite, HasWriter, Writer}, }; -use alloc::vec::Vec; use core::{mem, num::NonZeroUsize, option}; +#[cfg(not(feature = "std"))] +use alloc::vec::Vec; + /// Allocate a vector with a given capacity and sets the length to that capacity. #[must_use] pub fn uninit(capacity: usize) -> Vec { diff --git a/commons/zenoh-collections/src/properties.rs b/commons/zenoh-collections/src/properties.rs index 6da7178c57..281ac8ca68 100644 --- a/commons/zenoh-collections/src/properties.rs +++ b/commons/zenoh-collections/src/properties.rs @@ -13,7 +13,6 @@ // use std::{ collections::HashMap, - convert::{From, TryFrom}, fmt, ops::{Deref, DerefMut}, }; diff --git a/commons/zenoh-collections/src/single_or_vec.rs b/commons/zenoh-collections/src/single_or_vec.rs index 0490a66a71..c68ac6d8ff 100644 --- a/commons/zenoh-collections/src/single_or_vec.rs +++ b/commons/zenoh-collections/src/single_or_vec.rs @@ -12,7 +12,7 @@ // ZettaScale Zenoh Team, // -use alloc::{vec, vec::Vec}; +use alloc::vec; use core::{ cmp::PartialEq, fmt, iter, @@ -20,6 +20,9 @@ use core::{ ptr, slice, }; +#[cfg(not(feature = "std"))] +use alloc::vec::Vec; + #[derive(Clone, Eq)] enum SingleOrVecInner { Single(T), diff --git a/commons/zenoh-result/src/lib.rs b/commons/zenoh-result/src/lib.rs index 563b11eee3..60148c763f 100644 --- a/commons/zenoh-result/src/lib.rs +++ b/commons/zenoh-result/src/lib.rs @@ -20,7 +20,6 @@ #![cfg_attr(not(feature = "std"), no_std)] extern crate alloc; -use alloc::boxed::Box; use anyhow::Error as AnyError; use core::fmt; @@ -39,6 +38,8 @@ pub const fn unlikely(b: bool) -> bool { b } +#[cfg(not(feature = "std"))] +use alloc::boxed::Box; #[cfg(not(feature = "std"))] use core::any::Any; diff --git a/zenoh/src/info.rs b/zenoh/src/info.rs index 848a5cb68b..5b9ef457ec 100644 --- a/zenoh/src/info.rs +++ b/zenoh/src/info.rs @@ -149,7 +149,7 @@ impl<'a> AsyncResolve for PeersZidBuilder<'a> { } } -/// Struct returned by [`Session::info()`](crate::Session::info) which allows +/// Struct returned by [`Session::info()`](crate::SessionDeclarations::info) which allows /// to access informations about the current zenoh [`Session`](crate::Session). /// /// # Examples diff --git a/zenoh/src/key_expr.rs b/zenoh/src/key_expr.rs index 2eee6c0665..c563592119 100644 --- a/zenoh/src/key_expr.rs +++ b/zenoh/src/key_expr.rs @@ -22,8 +22,8 @@ //! # Storing Key Expressions //! This module provides 3 flavours to store strings that have been validated to respect the KE syntax: //! - [`keyexpr`] is the equivalent of a [`str`], -//! - [`OwnedKeyExpr`] works like an [`Arc`], -//! - [`KeyExpr`] works like a [`Cow`], but also stores some additional context internal to Zenoh to optimize +//! - [`OwnedKeyExpr`] works like an [`std::sync::Arc`], +//! - [`KeyExpr`] works like a [`std::borrow::Cow`], but also stores some additional context internal to Zenoh to optimize //! routing and network usage. //! //! All of these types [`Deref`](core::ops::Deref) to [`keyexpr`], which notably has methods to check whether a given [`keyexpr::intersects`] with another, diff --git a/zenoh/src/plugins/sealed.rs b/zenoh/src/plugins/sealed.rs index 28c66d83b6..cc11fc213d 100644 --- a/zenoh/src/plugins/sealed.rs +++ b/zenoh/src/plugins/sealed.rs @@ -94,7 +94,7 @@ pub trait RunningPluginTrait: Send + Sync + PluginControl { /// Parameters: /// * `selector`: the full selector of the query (usually only key_expr part is used). This selector is /// exactly the same as it was requested by user, for example "@/router/ROUTER_ID/plugins/PLUGIN_NAME/some/plugin/info" or "@/router/*/plugins/*/foo/bar". - /// But the plugin's [adminspace_getter] is called only if the selector matches the [plugin_status_key] + /// But the plugin's [RunningPluginTrait::adminspace_getter] is called only if the selector matches the `plugin_status_key` /// * `plugin_status_key`: the actual path to plugin's status in the admin space. For example "@/router/ROUTER_ID/plugins/PLUGIN_NAME" /// Returns value: /// * `Ok(Vec)`: the list of responses to the query. For example if plugins can return information on subleys "foo", "bar", "foo/buzz" and "bar/buzz" diff --git a/zenoh/src/subscriber.rs b/zenoh/src/subscriber.rs index 7258833d28..f3fde38d20 100644 --- a/zenoh/src/subscriber.rs +++ b/zenoh/src/subscriber.rs @@ -51,7 +51,7 @@ impl fmt::Debug for SubscriberState { /// A subscriber that provides data through a callback. /// /// CallbackSubscribers can be created from a zenoh [`Session`](crate::Session) -/// with the [`declare_subscriber`](crate::Session::declare_subscriber) function +/// with the [`declare_subscriber`](crate::SessionDeclarations::declare_subscriber) function /// and the [`callback`](SubscriberBuilder::callback) function /// of the resulting builder. /// @@ -83,7 +83,7 @@ pub(crate) struct SubscriberInner<'a> { /// CallbackPullSubscribers only provide data when explicitely pulled by the /// application with the [`pull`](CallbackPullSubscriber::pull) function. /// CallbackPullSubscribers can be created from a zenoh [`Session`](crate::Session) -/// with the [`declare_subscriber`](crate::Session::declare_subscriber) function, +/// with the [`declare_subscriber`](crate::SessionDeclarations::declare_subscriber) function, /// the [`callback`](SubscriberBuilder::callback) function /// and the [`pull_mode`](SubscriberBuilder::pull_mode) function /// of the resulting builder. @@ -628,7 +628,7 @@ where /// A subscriber that provides data through a [`Handler`](crate::prelude::IntoCallbackReceiverPair). /// /// Subscribers can be created from a zenoh [`Session`](crate::Session) -/// with the [`declare_subscriber`](crate::Session::declare_subscriber) function +/// with the [`declare_subscriber`](crate::SessionDeclarations::declare_subscriber) function /// and the [`with`](SubscriberBuilder::with) function /// of the resulting builder. /// @@ -663,7 +663,7 @@ pub struct Subscriber<'a, Receiver> { /// PullSubscribers only provide data when explicitely pulled by the /// application with the [`pull`](PullSubscriber::pull) function. /// PullSubscribers can be created from a zenoh [`Session`](crate::Session) -/// with the [`declare_subscriber`](crate::Session::declare_subscriber) function, +/// with the [`declare_subscriber`](crate::SessionDeclarations::declare_subscriber) function, /// the [`with`](SubscriberBuilder::with) function /// and the [`pull_mode`](SubscriberBuilder::pull_mode) function /// of the resulting builder.