Skip to content

Fix broken links in rustdocs #6160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mullvad-api/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(rustdoc::private_intra_doc_links)]
#[cfg(target_os = "android")]
use futures::channel::mpsc;
use hyper::Method;
Expand Down Expand Up @@ -279,8 +280,7 @@ impl ApiEndpoint {
}

/// Read the [`Self::address`] value, falling back to
/// [`Self::API_IP_DEFAULT`]:[`Self::API_PORT_DEFAULT`] as default if it
/// does not exist.
/// [`Self::API_IP_DEFAULT`] as default value if it does not exist.
pub fn address(&self) -> SocketAddr {
self.address.unwrap_or(SocketAddr::new(
ApiEndpoint::API_IP_DEFAULT,
Expand Down
2 changes: 1 addition & 1 deletion mullvad-api/src/relay_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::{
time::Duration,
};

/// Fetches relay list from https://api.mullvad.net/app/v1/relays
/// Fetches relay list from <https://api.mullvad.net/app/v1/relays>
#[derive(Clone)]
pub struct RelayListProxy {
handle: rest::MullvadRestHandle,
Expand Down
8 changes: 4 additions & 4 deletions mullvad-cli/src/cmds/api_access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ pub struct EditCustomCommands {
/// Which API access method to edit
#[clap(flatten)]
item: SelectItem,
/// Name of the API access method in the Mullvad client [All]
/// Name of the API access method in the Mullvad client \[All\]
#[arg(long)]
name: Option<String>,
/// Editing parameters
Expand All @@ -350,7 +350,7 @@ pub struct EditCustomCommands {

#[derive(Args, Debug, Clone)]
pub struct EditParams {
/// Name of the API access method in the Mullvad client [All]
/// Name of the API access method in the Mullvad client \[All\]
#[arg(long)]
name: Option<String>,
#[clap(flatten)]
Expand Down Expand Up @@ -406,7 +406,7 @@ mod conversions {
}
}

/// Pretty printing of [`ApiAccessMethod`]s
/// Pretty printing of [`AccessMethodSetting`]s
mod pp {
use crate::cmds::proxies::pp::CustomProxyFormatter;
use mullvad_types::access_method::{AccessMethod, AccessMethodSetting};
Expand All @@ -418,7 +418,7 @@ mod pp {

pub struct FormatterSettings {
/// If the formatter should print the enabled status of an
/// [`AcessMethodSetting`] (*) next to its name.
/// [`AccessMethodSetting`] (*) next to its name.
pub write_enabled: bool,
}

Expand Down
14 changes: 7 additions & 7 deletions mullvad-cli/src/cmds/proxies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,25 +102,25 @@ pub struct SocksAuthentication {

#[derive(Args, Debug, Clone)]
pub struct ProxyEditParams {
/// Username for authentication [Socks5 (Remote proxy)]
/// Username for authentication \[Socks5 (Remote proxy)\]
#[arg(long)]
pub username: Option<String>,
/// Password for authentication [Socks5 (Remote proxy), Shadowsocks]
/// Password for authentication \[Socks5 (Remote proxy), Shadowsocks\]
#[arg(long)]
pub password: Option<String>,
/// Cipher to use [Shadowsocks]
/// Cipher to use \[Shadowsocks\]
#[arg(value_parser = SHADOWSOCKS_CIPHERS, long)]
pub cipher: Option<String>,
/// The IP of the remote proxy server [Socks5 (Local & Remote proxy), Shadowsocks]
/// The IP of the remote proxy server \[Socks5 (Local & Remote proxy), Shadowsocks\]
#[arg(long)]
pub ip: Option<IpAddr>,
/// The port of the remote proxy server [Socks5 (Local & Remote proxy), Shadowsocks]
/// The port of the remote proxy server \[Socks5 (Local & Remote proxy), Shadowsocks\]
#[arg(long)]
pub port: Option<u16>,
/// The port that the server on localhost is listening on [Socks5 (Local proxy)]
/// The port that the server on localhost is listening on \[Socks5 (Local proxy)\]
#[arg(long)]
pub local_port: Option<u16>,
/// The transport protocol used by the remote proxy [Socks5 (Local proxy)]
/// The transport protocol used by the remote proxy \[Socks5 (Local proxy)\]
#[arg(long)]
pub transport_protocol: Option<TransportProtocol>,
}
Expand Down
7 changes: 4 additions & 3 deletions mullvad-daemon/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,9 +480,10 @@ impl AccessModeSelector {
}
}
None => {
// Current method was removed: A new access method will suddenly have the same index as the one
// we are removing, but we want it to still be a candidate. A minor
// hack to achieve this is to simply decrement the current index.
// Current method was removed: A new access method will suddenly have the same index
// as the one we are removing, but we want it to still be a
// candidate. A minor hack to achieve this is to simply decrement
// the current index.
self.index = self.index.saturating_sub(1);
self.next_connection_mode().await?;
}
Expand Down
1 change: 1 addition & 0 deletions mullvad-daemon/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![recursion_limit = "512"]
#![allow(rustdoc::private_intra_doc_links)]

mod access_method;
pub mod account_history;
Expand Down
6 changes: 3 additions & 3 deletions mullvad-daemon/src/management_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ impl ManagementInterfaceEventBroadcaster {
}
}

/// Converts [`mullvad_daemon::Error`] into a tonic status.
/// Converts [`crate::Error`] into a tonic status.
fn map_daemon_error(error: crate::Error) -> Status {
use crate::Error as DaemonError;

Expand Down Expand Up @@ -1150,7 +1150,7 @@ fn map_rest_error(error: &RestError) -> Status {
}
}

/// Converts an instance of [`mullvad_daemon::device::Error`] into a tonic status.
/// Converts an instance of [`crate::device::Error`] into a tonic status.
fn map_device_error(error: &device::Error) -> Status {
match error {
device::Error::MaxDevicesReached => Status::new(Code::ResourceExhausted, error.to_string()),
Expand All @@ -1168,7 +1168,7 @@ fn map_device_error(error: &device::Error) -> Status {
}
}

/// Converts an instance of [`mullvad_daemon::account_history::Error`] into a tonic status.
/// Converts an instance of [`crate::account_history::Error`] into a tonic status.
fn map_account_history_error(error: account_history::Error) -> Status {
match error {
account_history::Error::Read(..) | account_history::Error::Write(..) => {
Expand Down
2 changes: 1 addition & 1 deletion mullvad-daemon/src/migrations/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
// Section for vendoring types and values that
// this settings version depend on. See `mod.rs`.

/// The tunnel protocol used by a [`TunnelEndpoint`].
/// The tunnel protocol used by a [`TunnelEndpoint`][talpid_types::net::TunnelEndpoint].
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename = "tunnel_type")]
pub enum TunnelType {
Expand Down
9 changes: 1 addition & 8 deletions mullvad-management-interface/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,14 +605,7 @@ impl MullvadProxyClient {
.map(drop)
}

/// Set the [`AccessMethod`] which [`ApiConnectionModeProvider`] should
/// pick.
///
/// - `access_method`: If `Some(access_method)`, [`ApiConnectionModeProvider`] will skip ahead
/// and return `access_method` when asked for a new access method. If `None`,
/// [`ApiConnectionModeProvider`] will pick the next access method "randomly"
///
/// [`ApiConnectionModeProvider`]: mullvad_daemon::api::ApiConnectionModeProvider
/// Set the [`AccessMethod`] which `AccessModeSelector` should pick.
pub async fn set_access_method(&mut self, api_access_method: access_method::Id) -> Result<()> {
self.0
.set_api_access_method(types::Uuid::from(api_access_method))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ mod settings {
}
}

/// Implements conversions for the auxilliary
/// [`crate::types::proto::ApiAccessMethod`] type to the internal
/// Implements conversions for the auxiliary
/// [`crate::types::proto::AccessMethodSetting`] type to the internal
/// [`mullvad_types::access_method::AccessMethodSetting`] data type.
mod data {
use crate::types::{proto, FromProtobufTypeError};
Expand Down
9 changes: 4 additions & 5 deletions mullvad-relay-selector/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
//! When changing relay selection, please verify if `docs/relay-selector.md` needs to be
//! updated as well.

#![allow(rustdoc::private_intra_doc_links)]
mod constants;
mod error;
#[cfg_attr(target_os = "android", allow(unused))]
mod relay_selector;

// Re-exports
pub use error::Error;
pub use relay_selector::detailer;
pub use relay_selector::{
query, AdditionalRelayConstraints, AdditionalWireguardConstraints, GetRelay, RelaySelector,
RuntimeParameters, SelectedBridge, SelectedObfuscator, SelectorConfig, WireguardConfig,
RETRY_ORDER,
detailer, query, AdditionalRelayConstraints, AdditionalWireguardConstraints, GetRelay,
RelaySelector, RuntimeParameters, SelectedBridge, SelectedObfuscator, SelectorConfig,
WireguardConfig, RETRY_ORDER,
};
2 changes: 1 addition & 1 deletion mullvad-relay-selector/src/relay_selector/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use talpid_types::net::obfuscation::ObfuscatorConfig;

use crate::SelectedObfuscator;

/// Picks a relay using [pick_random_relay_fn], using the `weight` member of each relay
/// Picks a relay using [pick_random_relay_weighted], using the `weight` member of each relay
/// as the weight function.
pub fn pick_random_relay(relays: &[Relay]) -> Option<&Relay> {
pick_random_relay_weighted(relays, |relay| relay.weight)
Expand Down
16 changes: 9 additions & 7 deletions mullvad-relay-selector/src/relay_selector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,17 @@ impl Default for RuntimeParameters {
/// This enum exists to separate the two types of [`SelectorConfig`] that exists.
///
/// The first one is a "regular" config, where [`SelectorConfig::relay_settings`] is
/// [`RelaySettings::Normal`]. This is the most common variant, and there exists a mapping from this
/// variant to [`RelayQueryBuilder`]. Being able to implement `From<NormalSelectorConfig> for
/// RelayQueryBuilder` was the main motivator for introducing these seemingly useless derivates of
/// [`SelectorConfig`].
/// [`RelaySettings::Normal`]. This is the most common variant, and there exists a
/// mapping from this variant to [`RelayQueryBuilder`]. Being able to implement
/// `From<NormalSelectorConfig> for RelayQueryBuilder` was the main motivator for introducing these
/// seemingly useless derivates of [`SelectorConfig`].
///
/// The second one is a custom config, where [`SelectorConfig::relay_settings`] is
/// [`RelaySettings::Custom`]. For this variant, the endpoint where the client should connect to is
/// already specified inside of the variant, so in practice the relay selector becomes superfluous.
/// Also, there exists no mapping to [`RelayQueryBuilder`].
/// [`RelaySettings::CustomTunnelEndpoint`]. For this variant, the endpoint where the client should
/// connect to is already specified inside of the variant, so in practice the relay selector becomes
/// superfluous. Also, there exists no mapping to [`RelayQueryBuilder`].
///
/// [`RelayQueryBuilder`]: query::builder::RelayQueryBuilder
#[derive(Debug, Clone)]
enum SpecializedSelectorConfig<'a> {
// This variant implements `From<NormalSelectorConfig> for RelayQuery`
Expand Down
10 changes: 5 additions & 5 deletions mullvad-types/src/access_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl Settings {
self.custom.push(api_access_method)
}

/// Remove an [`ApiAccessMethod`] from `api_access_methods`.
/// Remove an [`AccessMethod`] from `api_access_methods`.
///
/// This function will return an error if a built-in API access is about to
/// be removed.
Expand Down Expand Up @@ -205,15 +205,15 @@ impl AccessMethodSetting {
}
}

/// Just like [`new`], [`with_id`] will create a new [`ApiAccessMethod`].
/// Just like [`new`], [`with_id`] will create a new [`AccessMethodSetting`].
/// But instead of automatically generating a new UUID, the id is instead
/// passed as an argument.
///
/// This is useful when converting to [`ApiAccessMethod`] from other data
/// This is useful when converting to [`AccessMethodSetting`] from other data
/// representations, such as protobuf.
///
/// [`new`]: ApiAccessMethod::new
/// [`with_id`]: ApiAccessMethod::with_id
/// [`new`]: AccessMethodSetting::new
/// [`with_id`]: AccessMethodSetting::with_id
pub fn with_id(id: Id, name: String, enabled: bool, access_method: AccessMethod) -> Self {
Self {
id,
Expand Down
18 changes: 10 additions & 8 deletions mullvad-types/src/constraints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,27 @@ impl<T: Match<U>, U> Match<U> for Constraint<T> {
}
}

// NOTE: This docstring cannot link to `mullvad_relay_selector::relay_selector::query` and
// `RETRY_ORDER`as `mullvad_relay_selector` is not a dependency of this crate
/// The intersection of two sets of criteria on [`Relay`](crate::relay_list::Relay)s is another
/// criteria which matches the given relay iff both of the original criteria matched. It is
/// primarily used by the relay selector to check whether a given connection method is compatible
/// with the users settings.
///
/// # Examples
///
/// The [`Intersection`] implementation of [`RelayQuery`] upholds the following properties:
/// The [`Intersection`] implementation of
/// `mullvad_relay_selector::relay_selector::query::RelayQuery` upholds the following properties:
///
/// * If two [`RelayQuery`]s differ such that no relay matches both, [`Option::None`] is returned:
/// * If two `RelayQuery`s differ such that no relay matches both, [`Option::None`] is returned:
/// ```rust, ignore
/// # use mullvad_relay_selector::query::builder::RelayQueryBuilder;
/// let query_a = RelayQueryBuilder::new().wireguard().build();
/// let query_b = RelayQueryBuilder::new().openvpn().build();
/// assert_eq!(query_a.intersection(query_b), None);
/// ```
///
/// * Otherwise, a new [`RelayQuery`] is returned where each constraint is
/// * Otherwise, a new `RelayQuery` is returned where each constraint is
/// as specific as possible. See [`Constraint`] for further details.
/// ```rust, ignore
/// let query_a = RelayQueryBuilder::new().wireguard().build();
Expand All @@ -47,11 +50,10 @@ impl<T: Match<U>, U> Match<U> for Constraint<T> {
/// ```
///
/// This way, if the mullvad app wants to check if the user's relay settings
/// are compatible with any other [`RelayQuery`], for examples those defined by
/// [`RETRY_ORDER`] , taking the intersection between them will never result in
/// are compatible with any other `RelayQuery`, for examples those defined by
/// `RETRY_ORDER` , taking the intersection between them will never result in
/// a situation where the app can override the user's preferences.
///
/// [`RETRY_ORDER`]: crate::RETRY_ORDER
///
/// The macro recursively applies the intersection on each field of the struct and returns the
/// resulting type or `None` if any of the intersections failed to overlap.
Expand All @@ -62,7 +64,7 @@ impl<T: Match<U>, U> Match<U> for Constraint<T> {
/// # Implementing [`Intersection`]
///
/// For structs where each field already implements `Intersection`, the easiest way to implement the
/// trait is using the derive macro. Using the derive macro on [`RelayQuery`]
/// trait is using the derive macro. Using the derive macro on `RelayQuery`
/// ```rust, ignore
/// #[derive(Intersection)]
/// struct RelayQuery {
Expand Down Expand Up @@ -106,7 +108,7 @@ impl<T: Match<U>, U> Match<U> for Constraint<T> {
/// For less trivial cases, the trait needs to be implemented manually. When doing so, make sure
/// that the following properties are upheld:
///
/// - idempotency (if there is an identity element)
/// - idempotence (if there is an identity element)
/// - commutativity
/// - associativity
pub trait Intersection: Sized {
Expand Down
4 changes: 2 additions & 2 deletions mullvad-types/src/location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl Coordinates {
/// back to spherical coordinates. This is approximate, because the semi-minor (polar)
/// axis is assumed to equal the semi-major (equatorial) axis.
///
/// https://en.wikipedia.org/wiki/Spherical_coordinate_system#Cartesian_coordinates
/// <https://en.wikipedia.org/wiki/Spherical_coordinate_system#Cartesian_coordinates>
pub fn midpoint(locations: &[Location]) -> Self {
Self::midpoint_inner(locations.iter().map(Coordinates::from))
}
Expand Down Expand Up @@ -110,7 +110,7 @@ fn haversine_dist_deg(lat: f64, lon: f64, other_lat: f64, other_lon: f64) -> f64
other_lon.to_radians(),
)
}
/// Implemented as per https://en.wikipedia.org/wiki/Haversine_formula and https://rosettacode.org/wiki/Haversine_formula#Rust
/// Implemented as per <https://en.wikipedia.org/wiki/Haversine_formula> and <https://rosettacode.org/wiki/Haversine_formula#Rust>
/// Takes input as radians, outputs kilometers.
fn haversine_dist_rad(lat: f64, lon: f64, other_lat: f64, other_lon: f64) -> f64 {
let d_lat = lat - other_lat;
Expand Down
2 changes: 1 addition & 1 deletion talpid-routing/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Manage routing tables on various platforms.

#![allow(rustdoc::private_intra_doc_links)]
#![deny(missing_docs)]

use ipnetwork::IpNetwork;
Expand Down
2 changes: 1 addition & 1 deletion talpid-routing/src/windows/default_route_monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub struct DefaultRouteMonitor {
}

/// SAFETY: DefaultRouteMonitor is `Send` since `NotifyChangeHandle` is `Send` and
/// `ContextAndBurstGuard` is `Sync` as it holds Mutex<T> and Arc<Mutex<T>> fields.
/// `ContextAndBurstGuard` is `Sync` as it holds `Mutex<T>` and `Arc<Mutex<T>>` fields.
unsafe impl Send for DefaultRouteMonitor {}

impl Drop for DefaultRouteMonitor {
Expand Down
2 changes: 1 addition & 1 deletion talpid-routing/src/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl RouteManagerHandle {
_ = result_rx.await;
}

/// Removes all routes previously applied in [`RouteManager::add_routes`].
/// Removes all routes previously applied in [`RouteManagerInternal::add_routes`].
pub fn clear_routes(&self) -> Result<()> {
self.tx
.unbounded_send(RouteManagerCommand::ClearRoutes)
Expand Down
5 changes: 1 addition & 4 deletions talpid-types/src/net/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,8 @@ impl From<Shadowsocks> for CustomProxy {
pub struct Shadowsocks {
pub endpoint: SocketAddr,
pub password: String,
/// One of [`shadowsocks_ciphers`].
/// One of [`SHADOWSOCKS_CIPHERS`].
/// Gets validated at a later stage. Is assumed to be valid.
///
/// shadowsocks_ciphers: talpid_types::net::openvpn::SHADOWSOCKS_CIPHERS
pub cipher: String,
}

Expand Down Expand Up @@ -236,7 +234,6 @@ impl Socks5Remote {
}

/// List of ciphers usable by a Shadowsocks proxy.
/// Cf. [`ShadowsocksProxySettings::cipher`].
pub const SHADOWSOCKS_CIPHERS: [&str; 19] = [
// Stream ciphers.
"aes-128-cfb",
Expand Down
Loading
Loading