diff --git a/examples/rust/get_started/examples/11-attribute-based-authentication.rs b/examples/rust/get_started/examples/11-attribute-based-authentication.rs index 7e0bcc768eb..26f6aa5d6d5 100644 --- a/examples/rust/get_started/examples/11-attribute-based-authentication.rs +++ b/examples/rust/get_started/examples/11-attribute-based-authentication.rs @@ -1,91 +1,91 @@ -/// INTRODUCTION -/// -/// This example shows how to use attribute-based credential in order to have -/// several devices connecting to a server, via the Ockam Orchestrator. -/// -/// The corresponding example using the command-line can be found here: https://docs.ockam.io/use-cases/apply-fine-grained-permissions-with-attribute-based-access-control-abac. -/// -/// You first need to: -/// -/// - create a project with `ockam enroll` -/// - export the project information with `ockam project information > project.json` -/// -/// Then you can start: -/// -/// - a local Python webserver: `python3 -m http.server --bind 127.0.0.1 5000` -/// - the control node in `11-attribute-based-authentication-control-plane.rs` -/// - the edge node in `11-attribute-based-authentication-edge-plane.rs` -/// -/// This will set up a TCP outlet on the control node, connected to the Python webserver -/// and a TCP inlet on the edge node which can be used to send HTTP requests (at 127.0.0.1:7000). -/// -/// Then if you execute `curl --fail --head --max-time 10 127.0.0.1:7000` you should get back -/// a successful response like: -/// -/// HTTP/1.0 200 OK -/// Server: SimpleHTTP/0.6 Python/3.9.6 -/// Date: Tue, 07 Feb 2023 15:05:59 GMT -/// Content-type: text/html; charset=utf-8 -/// Content-Length: 870 -/// -/// and observe that a successful connection has been made on the Python webserver: -/// -/// ± python3 -m http.server --bind 127.0.0.1 5000 default -/// Serving HTTP on 127.0.0.1 port 5000 (http://127.0.0.1:5000/) ... -/// 127.0.0.1 - - [06/Feb/2023 15:52:20] "HEAD / HTTP/1.1" 200 - -/// -/// TOPOLOGY -/// -/// The network we establish between the control node, the edge node and the Orchestrator is the following -/// -/// get credential +-------------------------------------+ -/// via secure channel | | Inlet <-- 127.0.0.1:7000 -/// +---------------+ Edge node | connected to "outlet" -/// | | | via secure channel -/// | +-------------------------------------+ -/// | | | -/// | | | create secure channel to control -/// | | | via the relay -/// v v | -/// +--------------+ +-------------------------------+-------+ -/// | Authority | | | | -/// | | | Orchestrator | | -/// | | | | | -/// +--------------+ +---------------------- forwarder ------+ -/// ^ ^ to control -/// | | ^ | -/// | | create | | -/// | | | v -/// | | | "untrusted" secure channel -/// | +---------------------------------------+ listener -/// | | | -/// +---------------| Control node | "outlet" --> 127.0.0.1:5000 -/// get credential | | -/// via secure channel +---------------------------------------+ -/// -/// -/// - we create initially some secure channels to the Authority in order to retrieve credential -/// based on a one-time token generated with `ockam project ticket --attribute component=` -/// -/// - then the control node creates a relay on the Orchestrator in order to accept TCP traffic without -/// having to open a port to the internet. It also starts a channel listener ("untrusted", accept all incoming requests for now) -/// -/// - on its side the edge node starts a secure channel via relay (named "forward_to_control_plane1"), to the "untrusted" listener -/// with the secure channel address it creates an Inlet which will direct TCP traffic via the secure channel to get to the -/// control node and then to the "outlet" worker to reach the Python webserver -/// -/// - the outlet is configured to only receive messages from the edge node by checking its authenticated attributes -/// - the inlet is configured to only receive messages from the control node by checking its authenticated attributes -/// -/// IMPLEMENTATION -/// -/// The code for this example can be found in: -/// -/// - examples/11-attribute-based-authentication-control-plane.rs: for the control node -/// - examples/11-attribute-based-authentication-edge-plane.rs: for the edge node -/// - src/project.rs: read the content of the project.json file -/// - src/token.rs: generate a one-time token using the ockam command line -/// +//! INTRODUCTION +//! +//! This example shows how to use attribute-based credential in order to have +//! several devices connecting to a server, via the Ockam Orchestrator. +//! +//! The corresponding example using the command-line can be found here: https://docs.ockam.io/use-cases/apply-fine-grained-permissions-with-attribute-based-access-control-abac. +//! +//! You first need to: +//! +//! - create a project with `ockam enroll` +//! - export the project information with `ockam project information > project.json` +//! +//! Then you can start: +//! +//! - a local Python webserver: `python3 -m http.server --bind 127.0.0.1 5000` +//! - the control node in `11-attribute-based-authentication-control-plane.rs` +//! - the edge node in `11-attribute-based-authentication-edge-plane.rs` +//! +//! This will set up a TCP outlet on the control node, connected to the Python webserver +//! and a TCP inlet on the edge node which can be used to send HTTP requests (at 127.0.0.1:7000). +//! +//! Then if you execute `curl --fail --head --max-time 10 127.0.0.1:7000` you should get back +//! a successful response like: +//! +//! HTTP/1.0 200 OK +//! Server: SimpleHTTP/0.6 Python/3.9.6 +//! Date: Tue, 07 Feb 2023 15:05:59 GMT +//! Content-type: text/html; charset=utf-8 +//! Content-Length: 870 +//! +//! and observe that a successful connection has been made on the Python webserver: +//! +//! ± python3 -m http.server --bind 127.0.0.1 5000 default +//! Serving HTTP on 127.0.0.1 port 5000 (http://127.0.0.1:5000/) ... +//! 127.0.0.1 - - [06/Feb/2023 15:52:20] "HEAD / HTTP/1.1" 200 - +//! +//! TOPOLOGY +//! +//! The network we establish between the control node, the edge node and the Orchestrator is the following +//! +//! get credential +-------------------------------------+ +//! via secure channel | | Inlet <-- 127.0.0.1:7000 +//! +---------------+ Edge node | connected to "outlet" +//! | | | via secure channel +//! | +-------------------------------------+ +//! | | | +//! | | | create secure channel to control +//! | | | via the relay +//! v v | +//! +--------------+ +-------------------------------+-------+ +//! | Authority | | | | +//! | | | Orchestrator | | +//! | | | | | +//! +--------------+ +---------------------- forwarder ------+ +//! ^ ^ to control +//! | | ^ | +//! | | create | | +//! | | | v +//! | | | "untrusted" secure channel +//! | +---------------------------------------+ listener +//! | | | +//! +---------------| Control node | "outlet" --> 127.0.0.1:5000 +//! get credential | | +//! via secure channel +---------------------------------------+ +//! +//! +//! - we create initially some secure channels to the Authority in order to retrieve credential +//! based on a one-time token generated with `ockam project ticket --attribute component=` +//! +//! - then the control node creates a relay on the Orchestrator in order to accept TCP traffic without +//! having to open a port to the internet. It also starts a channel listener ("untrusted", accept all incoming requests for now) +//! +//! - on its side the edge node starts a secure channel via relay (named "forward_to_control_plane1"), to the "untrusted" listener +//! with the secure channel address it creates an Inlet which will direct TCP traffic via the secure channel to get to the +//! control node and then to the "outlet" worker to reach the Python webserver +//! +//! - the outlet is configured to only receive messages from the edge node by checking its authenticated attributes +//! - the inlet is configured to only receive messages from the control node by checking its authenticated attributes +//! +//! IMPLEMENTATION +//! +//! The code for this example can be found in: +//! +//! - examples/11-attribute-based-authentication-control-plane.rs: for the control node +//! - examples/11-attribute-based-authentication-edge-plane.rs: for the edge node +//! - src/project.rs: read the content of the project.json file +//! - src/token.rs: generate a one-time token using the ockam command line +//! /// unused main function fn main() {} diff --git a/implementations/rust/ockam/ockam_abac/src/boolean_expr.rs b/implementations/rust/ockam/ockam_abac/src/boolean_expr.rs index 7bc348bf78d..bafbcd0e027 100644 --- a/implementations/rust/ockam/ockam_abac/src/boolean_expr.rs +++ b/implementations/rust/ockam/ockam_abac/src/boolean_expr.rs @@ -670,7 +670,7 @@ mod tests { test_parse_error(&mut "a=\"\"", "the value can't be empty"); } - /// HELPERS + // HELPERS /// Test the parsing of a name fn test_parse_name(input: &str) { diff --git a/implementations/rust/ockam/ockam_abac/src/expr.rs b/implementations/rust/ockam/ockam_abac/src/expr.rs index 485dec36431..cb4365c1bbc 100644 --- a/implementations/rust/ockam/ockam_abac/src/expr.rs +++ b/implementations/rust/ockam/ockam_abac/src/expr.rs @@ -610,7 +610,7 @@ mod tests { test_failure("a or b", &format!("The first identifier of the expression: `a or b` must be an operation. The available operations are: {}", OPERATORS.join(", "))); } - /// HELPERS + // HELPERS fn test_failure(s: &str, expected_message: &str) { match parse(s) { Err(e) => assert!(e.to_string().contains(expected_message)), diff --git a/implementations/rust/ockam/ockam_abac/src/policy/storage/resource_policy_repository_sql.rs b/implementations/rust/ockam/ockam_abac/src/policy/storage/resource_policy_repository_sql.rs index 35a5fec3484..33d67ab7780 100644 --- a/implementations/rust/ockam/ockam_abac/src/policy/storage/resource_policy_repository_sql.rs +++ b/implementations/rust/ockam/ockam_abac/src/policy/storage/resource_policy_repository_sql.rs @@ -205,7 +205,7 @@ mod test { Ok(()) } - /// HELPERS + // HELPERS async fn resource_policy_repository() -> Result> { Ok(Arc::new(ResourcePolicySqlxDatabase::create().await?)) } diff --git a/implementations/rust/ockam/ockam_abac/src/policy/storage/resource_repository_sql.rs b/implementations/rust/ockam/ockam_abac/src/policy/storage/resource_repository_sql.rs index fb38f129220..3bc7fc73e4e 100644 --- a/implementations/rust/ockam/ockam_abac/src/policy/storage/resource_repository_sql.rs +++ b/implementations/rust/ockam/ockam_abac/src/policy/storage/resource_repository_sql.rs @@ -170,7 +170,7 @@ mod test { Ok(()) } - /// HELPERS + // HELPERS async fn create_repository() -> Result> { Ok(Arc::new(ResourcesSqlxDatabase::create().await?)) } diff --git a/implementations/rust/ockam/ockam_abac/src/policy/storage/resource_type_policy_repository_sql.rs b/implementations/rust/ockam/ockam_abac/src/policy/storage/resource_type_policy_repository_sql.rs index f5cc4f34bb6..59455334fcb 100644 --- a/implementations/rust/ockam/ockam_abac/src/policy/storage/resource_type_policy_repository_sql.rs +++ b/implementations/rust/ockam/ockam_abac/src/policy/storage/resource_type_policy_repository_sql.rs @@ -245,7 +245,7 @@ mod test { Ok(()) } - /// HELPERS + // HELPERS async fn create_repository() -> Result> { Ok(Arc::new(ResourceTypePolicySqlxDatabase::create().await?)) } diff --git a/implementations/rust/ockam/ockam_api/src/authority_node/authority.rs b/implementations/rust/ockam/ockam_api/src/authority_node/authority.rs index 4706dd770b2..d8784def4d8 100644 --- a/implementations/rust/ockam/ockam_api/src/authority_node/authority.rs +++ b/implementations/rust/ockam/ockam_api/src/authority_node/authority.rs @@ -523,7 +523,7 @@ pub mod tests { result.unwrap() } - /// HELPERS + // HELPERS /// Create an Authority configuration with: /// diff --git a/implementations/rust/ockam/ockam_api/src/cli_state/cli_state.rs b/implementations/rust/ockam/ockam_api/src/cli_state/cli_state.rs index 8cc70d47a74..8b40d4c4aec 100644 --- a/implementations/rust/ockam/ockam_api/src/cli_state/cli_state.rs +++ b/implementations/rust/ockam/ockam_api/src/cli_state/cli_state.rs @@ -448,7 +448,7 @@ mod tests { .await } - /// HELPERS + // HELPERS fn list_file_names(dir: &Path) -> Vec { fs::read_dir(dir) .unwrap() diff --git a/implementations/rust/ockam/ockam_api/src/cli_state/journeys/attributes.rs b/implementations/rust/ockam/ockam_api/src/cli_state/journeys/attributes.rs index 01318fd31e9..dec32b07225 100644 --- a/implementations/rust/ockam/ockam_api/src/cli_state/journeys/attributes.rs +++ b/implementations/rust/ockam/ockam_api/src/cli_state/journeys/attributes.rs @@ -255,7 +255,7 @@ mod tests { assert_eq!(now_as_string(datetime("2024-03-31T12:00:00Z")), "240330"); } - /// HELPERS + // HELPERS fn datetime(s: &str) -> DateTime { Utc.from_utc_datetime(&DateTime::parse_from_rfc3339(s).unwrap().naive_utc()) } diff --git a/implementations/rust/ockam/ockam_api/src/cli_state/journeys/journey_event.rs b/implementations/rust/ockam/ockam_api/src/cli_state/journeys/journey_event.rs index a3879ebc272..5cb293bad6d 100644 --- a/implementations/rust/ockam/ockam_api/src/cli_state/journeys/journey_event.rs +++ b/implementations/rust/ockam/ockam_api/src/cli_state/journeys/journey_event.rs @@ -1,7 +1,7 @@ use opentelemetry::Key; use std::fmt::{Display, Formatter}; -/// List of attribute keys for journey event creation +// List of attribute keys for journey event creation pub const TCP_OUTLET_AT: &Key = &Key::from_static_str("app.tcp_outlet.at"); pub const TCP_OUTLET_FROM: &Key = &Key::from_static_str("app.tcp_outlet.from"); diff --git a/implementations/rust/ockam/ockam_api/src/cli_state/storage/enrollments_repository_sql.rs b/implementations/rust/ockam/ockam_api/src/cli_state/storage/enrollments_repository_sql.rs index dfe12be7316..2a859648c34 100644 --- a/implementations/rust/ockam/ockam_api/src/cli_state/storage/enrollments_repository_sql.rs +++ b/implementations/rust/ockam/ockam_api/src/cli_state/storage/enrollments_repository_sql.rs @@ -226,7 +226,7 @@ mod tests { Ok(()) } - /// HELPERS + // HELPERS async fn create_identity(db: SqlxDatabase, name: &str) -> Result { let identities = identities().await?; let identifier = identities.identities_creation().create_identity().await?; diff --git a/implementations/rust/ockam/ockam_api/src/cli_state/storage/identities_repository_sql.rs b/implementations/rust/ockam/ockam_api/src/cli_state/storage/identities_repository_sql.rs index 1ac5501fafd..e9f767283c7 100644 --- a/implementations/rust/ockam/ockam_api/src/cli_state/storage/identities_repository_sql.rs +++ b/implementations/rust/ockam/ockam_api/src/cli_state/storage/identities_repository_sql.rs @@ -432,7 +432,7 @@ mod tests { .await } - /// HELPERS + // HELPERS async fn create_identity() -> Result { let identities = identities().await?; identities.identities_creation().create_identity().await diff --git a/implementations/rust/ockam/ockam_api/src/cli_state/storage/nodes_repository_sql.rs b/implementations/rust/ockam/ockam_api/src/cli_state/storage/nodes_repository_sql.rs index f60290e3677..3d18958e7c7 100644 --- a/implementations/rust/ockam/ockam_api/src/cli_state/storage/nodes_repository_sql.rs +++ b/implementations/rust/ockam/ockam_api/src/cli_state/storage/nodes_repository_sql.rs @@ -393,7 +393,7 @@ mod test { .await } - /// HELPERS + // HELPERS async fn create_identity() -> Result { let identities = identities().await?; identities.identities_creation().create_identity().await diff --git a/implementations/rust/ockam/ockam_api/src/cli_state/storage/projects_repository_sql.rs b/implementations/rust/ockam/ockam_api/src/cli_state/storage/projects_repository_sql.rs index 6eb955209cd..a1a077f3984 100644 --- a/implementations/rust/ockam/ockam_api/src/cli_state/storage/projects_repository_sql.rs +++ b/implementations/rust/ockam/ockam_api/src/cli_state/storage/projects_repository_sql.rs @@ -755,7 +755,7 @@ mod test { .await } - /// HELPERS + // HELPERS fn create_project( id: &str, name: &str, diff --git a/implementations/rust/ockam/ockam_api/src/control_api/frontend.rs b/implementations/rust/ockam/ockam_api/src/control_api/frontend.rs index f59452121c0..36412343430 100644 --- a/implementations/rust/ockam/ockam_api/src/control_api/frontend.rs +++ b/implementations/rust/ockam/ockam_api/src/control_api/frontend.rs @@ -442,7 +442,7 @@ mod test { use std::net::SocketAddr; use tokio::net::TcpStream; - async fn send_http_request<'a, S: Serialize + Send, D: DeserializeOwned + Send>( + async fn send_http_request( request: Request, ) -> Response { let host = request.uri().host().expect("uri has no host"); diff --git a/implementations/rust/ockam/ockam_api/src/logs/default_values.rs b/implementations/rust/ockam/ockam_api/src/logs/default_values.rs index 26d642bf42d..ddeda1fa136 100644 --- a/implementations/rust/ockam/ockam_api/src/logs/default_values.rs +++ b/implementations/rust/ockam/ockam_api/src/logs/default_values.rs @@ -1,9 +1,9 @@ use crate::logs::LogFormat; use std::time::Duration; -/// -/// LOGGING -/// +// +// LOGGING +// /// Log format for files. See LogFormat for other values pub(crate) const DEFAULT_LOG_FORMAT: LogFormat = LogFormat::Default; @@ -18,9 +18,9 @@ pub(crate) const DEFAULT_LOG_MAX_FILES: u64 = 60; pub(crate) const DEFAULT_OPENTELEMETRY_ENDPOINT: &str = "https://otelcoll.orchestrator.ockam.io:443"; -/// -/// TRACING -/// +// +// TRACING +// /// Timeout for trying to access the Telemetry collector endpoint when running a command /// It is quite high but experimentation shows that sometimes there's quite some lag even if the endpoint is available diff --git a/implementations/rust/ockam/ockam_api/src/logs/env_variables.rs b/implementations/rust/ockam/ockam_api/src/logs/env_variables.rs index 74a716af2ad..18a06e45b89 100644 --- a/implementations/rust/ockam/ockam_api/src/logs/env_variables.rs +++ b/implementations/rust/ockam/ockam_api/src/logs/env_variables.rs @@ -1,6 +1,6 @@ -/// -/// LOGGING CONFIGURATION -/// +// +// LOGGING CONFIGURATION +// /// Decides if logs should be created. Accepted values, see FromString. For example; true, false, 1, 0 pub(crate) const OCKAM_LOGGING: &str = "OCKAM_LOGGING"; @@ -8,9 +8,9 @@ pub(crate) const OCKAM_LOGGING: &str = "OCKAM_LOGGING"; /// Required log level. Accepted values, see LevelVar. For example: trace, debug, info, warn, error pub(crate) const OCKAM_LOG_LEVEL: &str = "OCKAM_LOG_LEVEL"; -/// -/// LOG FILE CONFIGURATION -/// +// +//LOG FILE CONFIGURATION +// /// Max size of a log file before it is rotated, in Mb pub(crate) const OCKAM_LOG_MAX_SIZE_MB: &str = "OCKAM_LOG_MAX_SIZE_MB"; @@ -24,9 +24,9 @@ pub(crate) const OCKAM_LOG_FORMAT: &str = "OCKAM_LOG_FORMAT"; /// Filter for log messages based on crate names. Accepted values: 'all' or 'comma-separated strings'. For example: ockam_core,ockam_api pub(crate) const OCKAM_LOG_CRATES_FILTER: &str = "OCKAM_LOG_CRATES_FILTER"; -/// -/// TRACING CONFIGURATION -/// +// +// TRACING CONFIGURATION +// /// Decides if spans and log records should be created and exported. Accepted values, see BooleanVar. For example; true, false, 1, 0 pub(crate) const OCKAM_TELEMETRY_EXPORT: &str = "OCKAM_TELEMETRY_EXPORT"; @@ -58,9 +58,9 @@ pub const OCKAM_DEVELOPER: &str = "OCKAM_DEVELOPER"; /// If this variable is true, print statements will debug the setting of the OpenTelemetry export pub(crate) const OCKAM_OPENTELEMETRY_EXPORT_DEBUG: &str = "OCKAM_OPENTELEMETRY_EXPORT_DEBUG"; -/// -/// TELEMETRY COLLECTOR ENDPOINT CONFIGURATION -/// +// +// TELEMETRY COLLECTOR ENDPOINT CONFIGURATION +// /// URL for the OpenTelemetry collector. Accepted values, see UrlVar. For example: http://127.0.0.1:4317 pub(crate) const OCKAM_OPENTELEMETRY_ENDPOINT: &str = "OCKAM_OPENTELEMETRY_ENDPOINT"; @@ -75,9 +75,9 @@ pub(crate) const OCKAM_FOREGROUND_TELEMETRY_ENDPOINT_CONNECTION_TIMEOUT: &str = pub(crate) const OCKAM_BACKGROUND_TELEMETRY_ENDPOINT_CONNECTION_TIMEOUT: &str = "OCKAM_BACKGROUND_TELEMETRY_ENDPOINT_CONNECTION_TIMEOUT"; -/// -/// TELEMETRY COLLECTOR EXPORT CONFIGURATION -/// +// +// TELEMETRY COLLECTOR EXPORT CONFIGURATION +// /// Timeout for trying to export spans to the endpoint. /// Accepted values, see DurationVar. For example: 500ms diff --git a/implementations/rust/ockam/ockam_api/src/logs/ockam_tonic_traces_client.rs b/implementations/rust/ockam/ockam_api/src/logs/ockam_tonic_traces_client.rs index e1592b33b1a..d7c8539ed2b 100644 --- a/implementations/rust/ockam/ockam_api/src/logs/ockam_tonic_traces_client.rs +++ b/implementations/rust/ockam/ockam_api/src/logs/ockam_tonic_traces_client.rs @@ -161,7 +161,7 @@ pub(crate) mod tests { assert!(result.is_ok()); } - /// HELPERS + // HELPERS /// Create a SecureChannels service for a local node pub(crate) async fn create_secure_channels() -> Result> { diff --git a/implementations/rust/ockam/ockam_api/src/logs/secure_client_service.rs b/implementations/rust/ockam/ockam_api/src/logs/secure_client_service.rs index c78040fc9ae..57835a96f59 100644 --- a/implementations/rust/ockam/ockam_api/src/logs/secure_client_service.rs +++ b/implementations/rust/ockam/ockam_api/src/logs/secure_client_service.rs @@ -244,7 +244,7 @@ mod tests { ); } - /// HELPERS + // HELPERS fn make_http_request() -> http::Request> { http::Request::builder() .method(Method::GET) diff --git a/implementations/rust/ockam/ockam_api/src/nodes/service/transport.rs b/implementations/rust/ockam/ockam_api/src/nodes/service/transport.rs index 1454666efd2..89ca03643bd 100644 --- a/implementations/rust/ockam/ockam_api/src/nodes/service/transport.rs +++ b/implementations/rust/ockam/ockam_api/src/nodes/service/transport.rs @@ -133,7 +133,7 @@ impl NodeManagerWorker { }) } - pub(super) async fn create_tcp_connection<'a>( + pub(super) async fn create_tcp_connection( &self, ctx: &Context, create: CreateTcpConnection, @@ -150,7 +150,7 @@ impl NodeManagerWorker { }) } - pub(super) async fn create_tcp_listener<'a>( + pub(super) async fn create_tcp_listener( &self, create: CreateTcpListener, ) -> Result, Response> { diff --git a/implementations/rust/ockam/ockam_api/src/orchestrator/email_address.rs b/implementations/rust/ockam/ockam_api/src/orchestrator/email_address.rs index dced88ddd88..70f317566bb 100644 --- a/implementations/rust/ockam/ockam_api/src/orchestrator/email_address.rs +++ b/implementations/rust/ockam/ockam_api/src/orchestrator/email_address.rs @@ -116,7 +116,7 @@ mod tests { } } - /// HELPERS + // HELPERS /// This newtype generates equal email addresses #[derive(Clone, PartialEq, Eq, Debug)] diff --git a/implementations/rust/ockam/ockam_api/src/orchestrator/project/models.rs b/implementations/rust/ockam/ockam_api/src/orchestrator/project/models.rs index 662b27ff090..d51e5513c1f 100644 --- a/implementations/rust/ockam/ockam_api/src/orchestrator/project/models.rs +++ b/implementations/rust/ockam/ockam_api/src/orchestrator/project/models.rs @@ -367,7 +367,7 @@ mod tests { } } - /// HELPERS + // HELPERS impl Arbitrary for OktaConfig { fn arbitrary(g: &mut Gen) -> Self { diff --git a/implementations/rust/ockam/ockam_api/src/orchestrator/project/project.rs b/implementations/rust/ockam/ockam_api/src/orchestrator/project/project.rs index ce968704954..f65faa188ce 100644 --- a/implementations/rust/ockam/ockam_api/src/orchestrator/project/project.rs +++ b/implementations/rust/ockam/ockam_api/src/orchestrator/project/project.rs @@ -389,7 +389,7 @@ mod tests { assert!(project.is_admin(&create_user("TEST@OCKAM.IO"))); } - /// HELPERS + // HELPERS fn create_admin(email: &str) -> ProjectUserRole { ProjectUserRole { email: email.try_into().unwrap(), diff --git a/implementations/rust/ockam/ockam_api/src/ui/terminal/highlighting.rs b/implementations/rust/ockam/ockam_api/src/ui/terminal/highlighting.rs index 8f1964739a5..be1fd1ae13e 100644 --- a/implementations/rust/ockam/ockam_api/src/ui/terminal/highlighting.rs +++ b/implementations/rust/ockam/ockam_api/src/ui/terminal/highlighting.rs @@ -33,7 +33,7 @@ pub struct TextHighlighter<'a> { pub theme: &'a Theme, } -impl<'a> TextHighlighter<'a> { +impl TextHighlighter<'_> { pub fn new(syntax: &str) -> Result { let syntax = SYNTAX_SET_NEWLINES .find_syntax_by_extension(syntax) diff --git a/implementations/rust/ockam/ockam_api/tests/logging_tracing.rs b/implementations/rust/ockam/ockam_api/tests/logging_tracing.rs index e1f93c7735e..af5aa61cfcf 100644 --- a/implementations/rust/ockam/ockam_api/tests/logging_tracing.rs +++ b/implementations/rust/ockam/ockam_api/tests/logging_tracing.rs @@ -89,7 +89,7 @@ async fn test_log_and_traces() { ) } -/// HELPERS +// HELPERS fn make_configuration() -> ockam_core::Result { Ok(LoggingConfiguration::new( diff --git a/implementations/rust/ockam/ockam_command/src/authority/create.rs b/implementations/rust/ockam/ockam_command/src/authority/create.rs index f32d1d9542e..b279903396e 100644 --- a/implementations/rust/ockam/ockam_command/src/authority/create.rs +++ b/implementations/rust/ockam/ockam_command/src/authority/create.rs @@ -516,7 +516,7 @@ mod tests { Ok(()) } - /// HELPERS + // HELPERS async fn create_identity() -> Result { let identities = identities().await?; Ok(identities.identities_creation().create_identity().await?) diff --git a/implementations/rust/ockam/ockam_command/src/kafka/inlet/show.rs b/implementations/rust/ockam/ockam_command/src/kafka/inlet/show.rs index 368876f4784..99b13d9d3e4 100644 --- a/implementations/rust/ockam/ockam_command/src/kafka/inlet/show.rs +++ b/implementations/rust/ockam/ockam_command/src/kafka/inlet/show.rs @@ -58,7 +58,7 @@ impl<'a> ShowTui<'a> { } #[async_trait] -impl<'a> ShowCommandTui for ShowTui<'a> { +impl ShowCommandTui for ShowTui<'_> { const ITEM_NAME: PluralTerm = PluralTerm::KafkaInlet; fn cmd_arg_item_name(&self) -> Option { diff --git a/implementations/rust/ockam/ockam_command/src/kafka/outlet/show.rs b/implementations/rust/ockam/ockam_command/src/kafka/outlet/show.rs index 8cb6fd97321..5cfada97d32 100644 --- a/implementations/rust/ockam/ockam_command/src/kafka/outlet/show.rs +++ b/implementations/rust/ockam/ockam_command/src/kafka/outlet/show.rs @@ -58,7 +58,7 @@ impl<'a> ShowTui<'a> { } #[async_trait] -impl<'a> ShowCommandTui for ShowTui<'a> { +impl ShowCommandTui for ShowTui<'_> { const ITEM_NAME: PluralTerm = PluralTerm::KafkaOutlet; fn cmd_arg_item_name(&self) -> Option { diff --git a/implementations/rust/ockam/ockam_command/src/space/show.rs b/implementations/rust/ockam/ockam_command/src/space/show.rs index 9b64ff5a19d..25944e3b1d7 100644 --- a/implementations/rust/ockam/ockam_command/src/space/show.rs +++ b/implementations/rust/ockam/ockam_command/src/space/show.rs @@ -67,7 +67,7 @@ impl<'a> ShowTui<'a> { } #[ockam_core::async_trait] -impl<'a> ShowCommandTui for ShowTui<'a> { +impl ShowCommandTui for ShowTui<'_> { const ITEM_NAME: PluralTerm = PluralTerm::Space; fn cmd_arg_item_name(&self) -> Option { diff --git a/implementations/rust/ockam/ockam_core/src/api.rs b/implementations/rust/ockam/ockam_core/src/api.rs index 8818d621deb..911e55c54f9 100644 --- a/implementations/rust/ockam/ockam_core/src/api.rs +++ b/implementations/rust/ockam/ockam_core/src/api.rs @@ -1158,7 +1158,7 @@ mod tests { assert_eq!(decoded_person, Some(person)); } - /// HELPERS + // HELPERS #[derive(Debug, Clone, Eq, PartialEq, Encode, Decode, CborLen, Message)] struct Person { diff --git a/implementations/rust/ockam/ockam_core/src/cbor/cow_bytes.rs b/implementations/rust/ockam/ockam_core/src/cbor/cow_bytes.rs index d2efb7ee8e8..741c64347f6 100644 --- a/implementations/rust/ockam/ockam_core/src/cbor/cow_bytes.rs +++ b/implementations/rust/ockam/ockam_core/src/cbor/cow_bytes.rs @@ -72,7 +72,7 @@ impl<'a> From> for Cow<'a, [u8]> { } } -impl<'a> Deref for CowBytes<'a> { +impl Deref for CowBytes<'_> { type Target = [u8]; fn deref(&self) -> &Self::Target { diff --git a/implementations/rust/ockam/ockam_core/src/cbor/cow_str.rs b/implementations/rust/ockam/ockam_core/src/cbor/cow_str.rs index c78bae45e39..89d2dc69ee5 100644 --- a/implementations/rust/ockam/ockam_core/src/cbor/cow_str.rs +++ b/implementations/rust/ockam/ockam_core/src/cbor/cow_str.rs @@ -75,7 +75,7 @@ impl<'a> From> for Cow<'a, str> { } } -impl<'a> Deref for CowStr<'a> { +impl Deref for CowStr<'_> { type Target = str; fn deref(&self) -> &Self::Target { @@ -83,19 +83,19 @@ impl<'a> Deref for CowStr<'a> { } } -impl<'a> Display for CowStr<'a> { +impl Display for CowStr<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { self.0.fmt(f) } } -impl<'a, S: ?Sized + AsRef> PartialEq for CowStr<'a> { +impl> PartialEq for CowStr<'_> { fn eq(&self, other: &S) -> bool { self.0 == other.as_ref() } } -impl<'a> AsRef for CowStr<'a> { +impl AsRef for CowStr<'_> { fn as_ref(&self) -> &str { self.0.as_ref() } diff --git a/implementations/rust/ockam/ockam_core/src/env/from_string.rs b/implementations/rust/ockam/ockam_core/src/env/from_string.rs index d7f1041361a..4be78bd15a6 100644 --- a/implementations/rust/ockam/ockam_core/src/env/from_string.rs +++ b/implementations/rust/ockam/ockam_core/src/env/from_string.rs @@ -14,7 +14,7 @@ pub trait FromString: Sized { fn from_string(s: &str) -> Result; } -/// Instances +// Instances impl FromString for Option { fn from_string(s: &str) -> Result { diff --git a/implementations/rust/ockam/ockam_core/src/hex_encoding.rs b/implementations/rust/ockam/ockam_core/src/hex_encoding.rs index 9b52aa059ce..ff3680994cb 100644 --- a/implementations/rust/ockam/ockam_core/src/hex_encoding.rs +++ b/implementations/rust/ockam/ockam_core/src/hex_encoding.rs @@ -29,12 +29,10 @@ where { match hex::decode(value.as_bytes()) { Ok(decoded) => Ok(decoded), - Err(_) => { - return Err(serde::de::Error::invalid_value( - Unexpected::Other("invalid hex"), - &self, - )) - } + Err(_) => Err(serde::de::Error::invalid_value( + Unexpected::Other("invalid hex"), + &self, + )), } } diff --git a/implementations/rust/ockam/ockam_executor/src/channel.rs b/implementations/rust/ockam/ockam_executor/src/channel.rs index 5f59e537f5d..d87266621dc 100644 --- a/implementations/rust/ockam/ockam_executor/src/channel.rs +++ b/implementations/rust/ockam/ockam_executor/src/channel.rs @@ -104,7 +104,7 @@ pub struct SendFuture<'a, T> { value: Option, } -impl<'a, T> Future for SendFuture<'a, T> { +impl Future for SendFuture<'_, T> { type Output = Result<(), error::SendError>; fn poll(mut self: Pin<&mut Self>, context: &mut Context<'_>) -> Poll { @@ -133,7 +133,7 @@ impl<'a, T> Future for SendFuture<'a, T> { } } -impl<'a, T> Unpin for SendFuture<'a, T> {} +impl Unpin for SendFuture<'_, T> {} /// Receiver pub struct Receiver(Arc>); @@ -158,7 +158,7 @@ pub struct ReceiveFuture<'a, T> { inner: &'a Inner, } -impl<'a, T> Future for ReceiveFuture<'a, T> { +impl Future for ReceiveFuture<'_, T> { type Output = Option; fn poll(self: Pin<&mut Self>, context: &mut Context<'_>) -> Poll { diff --git a/implementations/rust/ockam/ockam_executor/src/executor.rs b/implementations/rust/ockam/ockam_executor/src/executor.rs index e14f97fcda1..d64913267d0 100644 --- a/implementations/rust/ockam/ockam_executor/src/executor.rs +++ b/implementations/rust/ockam/ockam_executor/src/executor.rs @@ -41,7 +41,7 @@ pub struct Executor<'a> { marker: core::marker::PhantomData<&'a ()>, } -impl<'a> Executor<'a> { +impl Executor<'_> { pub fn new() -> Self { Self { tasks: UnsafeCell::new(BTreeMap::new()), @@ -168,7 +168,7 @@ impl<'a> Executor<'a> { } } -impl<'a> Default for Executor<'a> { +impl Default for Executor<'_> { fn default() -> Self { Self::new() } @@ -271,7 +271,7 @@ struct TaskWaker<'a> { marker: core::marker::PhantomData<&'a ()>, } -impl<'a> TaskWaker<'a> { +impl TaskWaker<'_> { fn new(task_id: TaskId, task_queue: Arc>) -> Waker { Waker::from(Arc::new(TaskWaker { task_id, @@ -285,7 +285,7 @@ impl<'a> TaskWaker<'a> { } } -impl<'a> Wake for TaskWaker<'a> { +impl Wake for TaskWaker<'_> { fn wake(self: Arc) { self.reschedule_task(); } diff --git a/implementations/rust/ockam/ockam_identity/src/identities/identities_attributes.rs b/implementations/rust/ockam/ockam_identity/src/identities/identities_attributes.rs index 9df0859face..d2f7cdafaea 100644 --- a/implementations/rust/ockam/ockam_identity/src/identities/identities_attributes.rs +++ b/implementations/rust/ockam/ockam_identity/src/identities/identities_attributes.rs @@ -93,7 +93,7 @@ mod tests { Ok(()) } - /// HELPERS + // HELPERS async fn create_attributes_entry( identifier: &Identifier, now: TimestampInSeconds, diff --git a/implementations/rust/ockam/ockam_identity/src/identities/storage/change_history_repository_sql.rs b/implementations/rust/ockam/ockam_identity/src/identities/storage/change_history_repository_sql.rs index 1ea8ed0ce4c..87003aafb86 100644 --- a/implementations/rust/ockam/ockam_identity/src/identities/storage/change_history_repository_sql.rs +++ b/implementations/rust/ockam/ockam_identity/src/identities/storage/change_history_repository_sql.rs @@ -310,7 +310,7 @@ mod tests { Ok(()) } - /// HELPERS + // HELPERS async fn create_identity() -> Result { let identities = identities().await?; let identifier = identities.identities_creation().create_identity().await?; diff --git a/implementations/rust/ockam/ockam_identity/src/identities/storage/identity_attributes_repository_sql.rs b/implementations/rust/ockam/ockam_identity/src/identities/storage/identity_attributes_repository_sql.rs index 56e4299f9f9..bba5b50509c 100644 --- a/implementations/rust/ockam/ockam_identity/src/identities/storage/identity_attributes_repository_sql.rs +++ b/implementations/rust/ockam/ockam_identity/src/identities/storage/identity_attributes_repository_sql.rs @@ -268,7 +268,7 @@ mod tests { .await } - /// HELPERS + // HELPERS async fn create_attributes_entry( identifier: &Identifier, now: TimestampInSeconds, diff --git a/implementations/rust/ockam/ockam_identity/src/models/credential_and_purpose_key.rs b/implementations/rust/ockam/ockam_identity/src/models/credential_and_purpose_key.rs index e2f4744d90a..b9890c6fbb2 100644 --- a/implementations/rust/ockam/ockam_identity/src/models/credential_and_purpose_key.rs +++ b/implementations/rust/ockam/ockam_identity/src/models/credential_and_purpose_key.rs @@ -99,7 +99,7 @@ mod tests { Ok(()) } - /// HELPERS + // HELPERS async fn create_credential() -> Result { let identities = identities().await?; let issuer = identities.identities_creation().create_identity().await?; diff --git a/implementations/rust/ockam/ockam_identity/src/purpose_keys/storage/purpose_keys_repository_sql.rs b/implementations/rust/ockam/ockam_identity/src/purpose_keys/storage/purpose_keys_repository_sql.rs index a2db9b6d4b5..03641afa127 100644 --- a/implementations/rust/ockam/ockam_identity/src/purpose_keys/storage/purpose_keys_repository_sql.rs +++ b/implementations/rust/ockam/ockam_identity/src/purpose_keys/storage/purpose_keys_repository_sql.rs @@ -212,7 +212,7 @@ mod tests { Ok(()) } - /// HELPERS + // HELPERS async fn create_repository() -> Result> { Ok(Arc::new(PurposeKeysSqlxDatabase::create().await?)) } diff --git a/implementations/rust/ockam/ockam_macros/src/internals/symbol.rs b/implementations/rust/ockam/ockam_macros/src/internals/symbol.rs index f666af63b2e..f4d7759b6b4 100644 --- a/implementations/rust/ockam/ockam_macros/src/internals/symbol.rs +++ b/implementations/rust/ockam/ockam_macros/src/internals/symbol.rs @@ -20,7 +20,7 @@ impl PartialEq for Ident { } } -impl<'a> PartialEq for &'a Ident { +impl PartialEq for &Ident { fn eq(&self, word: &Symbol) -> bool { *self == word.0 } @@ -32,7 +32,7 @@ impl PartialEq for Path { } } -impl<'a> PartialEq for &'a Path { +impl PartialEq for &Path { fn eq(&self, word: &Symbol) -> bool { self.is_ident(word.0) } diff --git a/implementations/rust/ockam/ockam_multiaddr/src/lib.rs b/implementations/rust/ockam/ockam_multiaddr/src/lib.rs index 2f4d5007fdf..ea0a28cb8e3 100644 --- a/implementations/rust/ockam/ockam_multiaddr/src/lib.rs +++ b/implementations/rust/ockam/ockam_multiaddr/src/lib.rs @@ -222,7 +222,7 @@ impl<'a> ProtoValue<'a> { } } -impl<'a> AsRef<[u8]> for ProtoValue<'a> { +impl AsRef<[u8]> for ProtoValue<'_> { fn as_ref(&self) -> &[u8] { &self.data() } diff --git a/implementations/rust/ockam/ockam_node/src/storage/database/migrations/migration_support/migrator.rs b/implementations/rust/ockam/ockam_node/src/storage/database/migrations/migration_support/migrator.rs index 7d62c7a2d65..6eb0bd19905 100644 --- a/implementations/rust/ockam/ockam_node/src/storage/database/migrations/migration_support/migrator.rs +++ b/implementations/rust/ockam/ockam_node/src/storage/database/migrations/migration_support/migrator.rs @@ -236,9 +236,9 @@ impl Migrator { } } - async fn needs_sql_migration<'a>( + async fn needs_sql_migration( &self, - migration: &'a SqlxMigration, + migration: &SqlxMigration, _connection: &mut AnyConnection, applied_migrations: &[AppliedMigration], ) -> Result { @@ -266,9 +266,9 @@ impl Migrator { } } - async fn apply_sql_migration<'a>( + async fn apply_sql_migration( &self, - migration: &'a SqlxMigration, + migration: &SqlxMigration, connection: &mut AnyConnection, applied_migrations: &[AppliedMigration], ) -> Result { @@ -308,9 +308,9 @@ impl Migrator { } } - async fn needs_rust_migration<'a>( + async fn needs_rust_migration( &self, - migration: &'a dyn RustMigration, + migration: &dyn RustMigration, connection: &mut AnyConnection, _applied_migrations: &[AppliedMigration], ) -> Result { diff --git a/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/postgres/migration_20250116100000_sqlite_initialization.rs b/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/postgres/migration_20250116100000_sqlite_initialization.rs index 9fc1bd5b1aa..57fe3ef8a4d 100644 --- a/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/postgres/migration_20250116100000_sqlite_initialization.rs +++ b/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/postgres/migration_20250116100000_sqlite_initialization.rs @@ -393,7 +393,7 @@ mod test { Ok(()) } - /// HELPERS + // HELPERS async fn insert_aead_secrets(sqlite_database: SqlxDatabase) -> Result<()> { for index in &["1", "2"] { let q = format!( diff --git a/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20231231100000_node_name_identity_attributes.rs b/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20231231100000_node_name_identity_attributes.rs index 8110cf04e1c..5ca8fca747b 100644 --- a/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20231231100000_node_name_identity_attributes.rs +++ b/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20231231100000_node_name_identity_attributes.rs @@ -192,7 +192,7 @@ mod test { Ok(()) } - /// HELPERS + // HELPERS fn create_attributes(identifier: &str) -> Result> { ockam_core::cbor_encode_preallocate(BTreeMap::from([ ("name".as_bytes().to_vec(), identifier.as_bytes().to_vec()), diff --git a/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20240111100001_add_authority_tables.rs b/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20240111100001_add_authority_tables.rs index 70c4a44e045..6383ca6156b 100644 --- a/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20240111100001_add_authority_tables.rs +++ b/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20240111100001_add_authority_tables.rs @@ -204,7 +204,7 @@ mod test { Ok(()) } - /// HELPERS + // HELPERS fn create_attributes(attributes: Vec<(Vec, Vec)>) -> Result> { let map: BTreeMap, Vec> = attributes.into_iter().collect(); ockam_core::cbor_encode_preallocate(map) diff --git a/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20240111100002_delete_trust_context.rs b/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20240111100002_delete_trust_context.rs index 09a80234040..ad9e3626919 100644 --- a/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20240111100002_delete_trust_context.rs +++ b/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20240111100002_delete_trust_context.rs @@ -307,7 +307,7 @@ mod test { Ok(()) } - /// HELPERS + // HELPERS fn insert_policy( resource: String, action: String, diff --git a/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20240212100000_split_policies.rs b/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20240212100000_split_policies.rs index 598ab2f3dfc..90277608be9 100644 --- a/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20240212100000_split_policies.rs +++ b/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20240212100000_split_policies.rs @@ -177,7 +177,7 @@ mod test { node_name: String, } - /// HELPERS + // HELPERS fn insert_policy(resource: &str) -> Query { let action = "handle_message"; let expression = random_string(); diff --git a/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20240313100000_remove_orphan_resources.rs b/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20240313100000_remove_orphan_resources.rs index 8be5c4f1cc3..df5095d6b96 100644 --- a/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20240313100000_remove_orphan_resources.rs +++ b/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20240313100000_remove_orphan_resources.rs @@ -166,7 +166,7 @@ mod test { Ok(()) } - /// HELPERS + // HELPERS fn insert_resource<'a>( resource: &'a str, node_name: &'a str, diff --git a/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20240503100000_update_policy_expressions.rs b/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20240503100000_update_policy_expressions.rs index 94bdd0e2ce2..8887fc5fd6b 100644 --- a/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20240503100000_update_policy_expressions.rs +++ b/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20240503100000_update_policy_expressions.rs @@ -133,7 +133,7 @@ mod test { node_name: String, } - /// HELPERS + // HELPERS fn insert_resource_policy(resource: &str) -> Query<'_, Any, AnyArguments<'_>> { let action = "handle_message"; let expression = "subject.has_credential"; diff --git a/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20250114100000_members_authority_id.rs b/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20250114100000_members_authority_id.rs index 575ebb0b80a..77d3ddc3ba8 100644 --- a/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20250114100000_members_authority_id.rs +++ b/implementations/rust/ockam/ockam_node/src/storage/database/migrations/node_migrations/rust/sqlite/migration_20250114100000_members_authority_id.rs @@ -124,7 +124,7 @@ mod test { Ok(()) } - /// HELPERS + // HELPERS fn insert_member(identifier: &str) -> Query<'_, Any, AnyArguments<'_>> { query("INSERT INTO authority_member (identifier, added_by, added_at, is_pre_trusted, attributes) VALUES ($1, $2, $3, $4, $5)") .bind(identifier) diff --git a/implementations/rust/ockam/ockam_node/src/storage/database/sqlx_database.rs b/implementations/rust/ockam/ockam_node/src/storage/database/sqlx_database.rs index a59303a352f..dd03f062104 100644 --- a/implementations/rust/ockam/ockam_node/src/storage/database/sqlx_database.rs +++ b/implementations/rust/ockam/ockam_node/src/storage/database/sqlx_database.rs @@ -718,7 +718,7 @@ pub mod tests { Ok(()) } - /// HELPERS + // HELPERS async fn insert_identity(db: &SqlxDatabase) -> Result { sqlx::query("INSERT INTO named_identity (identifier, name, vault_name, is_default) VALUES ($1, $2, $3, $4)") .bind("Ifa804b7fca12a19eed206ae180b5b576860ae651") diff --git a/implementations/rust/ockam/ockam_transport_ble/src/driver/stream.rs b/implementations/rust/ockam/ockam_transport_ble/src/driver/stream.rs index b0a9b02f4e3..8159c34d6c8 100644 --- a/implementations/rust/ockam/ockam_transport_ble/src/driver/stream.rs +++ b/implementations/rust/ockam/ockam_transport_ble/src/driver/stream.rs @@ -54,7 +54,7 @@ where (*guard).write(buffer).await } - async fn poll<'a, 'b>(&'a self, buffer: &'b mut [u8]) -> Result> { + async fn poll<'a>(&self, buffer: &'a mut [u8]) -> Result> { let mut guard = self.inner.lock().await; (*guard).poll(buffer).await } @@ -83,10 +83,7 @@ impl Source where A: BleStreamDriver + Send, { - pub async fn poll<'a, 'b>( - &'a self, - buffer: &'b mut [u8], - ) -> Result> { + pub async fn poll<'a>(&self, buffer: &'a mut [u8]) -> Result> { self.inner.poll(buffer).await } } diff --git a/implementations/rust/ockam/ockam_transport_core/src/transport.rs b/implementations/rust/ockam/ockam_transport_core/src/transport.rs index 6a1963c5b86..4c4109cb97f 100644 --- a/implementations/rust/ockam/ockam_transport_core/src/transport.rs +++ b/implementations/rust/ockam/ockam_transport_core/src/transport.rs @@ -6,13 +6,12 @@ use std::any::Any; #[cfg(feature = "std")] use std::sync::Arc; +pub const MAXIMUM_MESSAGE_LENGTH: usize = u16::MAX as usize; + /// Generic representation of a Transport /// At minimum, a Transport must be able /// - return its type /// - instantiate workers for all the addresses with that transport type in a Route - -pub const MAXIMUM_MESSAGE_LENGTH: usize = u16::MAX as usize; - #[async_trait] pub trait Transport: Send + Sync + 'static { /// Return the type of the Transport diff --git a/implementations/rust/ockam/ockam_transport_udp/src/workers/pending_messages/mod.rs b/implementations/rust/ockam/ockam_transport_udp/src/workers/pending_messages/mod.rs index 94964357fdf..aab3f875455 100644 --- a/implementations/rust/ockam/ockam_transport_udp/src/workers/pending_messages/mod.rs +++ b/implementations/rust/ockam/ockam_transport_udp/src/workers/pending_messages/mod.rs @@ -114,7 +114,7 @@ mod tests { Ok(()) } - impl<'a> UdpTransportMessage<'a> { + impl UdpTransportMessage<'_> { pub fn into_owned(self) -> UdpTransportMessage<'static> { UdpTransportMessage { version: self.version, diff --git a/implementations/rust/ockam/ockam_vault/src/storage/secrets_repository_sql.rs b/implementations/rust/ockam/ockam_vault/src/storage/secrets_repository_sql.rs index ed128aa40a8..67597f7c7af 100644 --- a/implementations/rust/ockam/ockam_vault/src/storage/secrets_repository_sql.rs +++ b/implementations/rust/ockam/ockam_vault/src/storage/secrets_repository_sql.rs @@ -481,7 +481,7 @@ mod test { Ok(()) } - /// HELPERS + // HELPERS async fn create_repository() -> Result> { Ok(Arc::new(SecretsSqlxDatabase::create().await?)) }