Skip to content

Commit

Permalink
bumped rust
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Jan 23, 2024
1 parent 75a2b8c commit 2d6621f
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 66 deletions.
62 changes: 23 additions & 39 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ members = [
"warpgate-web",
]
default-members = ["warpgate"]
resolver = "2"

[profile.release]
lto = true
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2023-01-11
nightly-2023-11-28
10 changes: 5 additions & 5 deletions warpgate-admin/src/api/roles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,7 @@ impl DetailApi {
.map_err(poem::error::InternalServerError)?;

Ok(match role {
Some(role) => GetRoleResponse::Ok(Json(
role.try_into().map_err(poem::error::InternalServerError)?,
)),
Some(role) => GetRoleResponse::Ok(Json(role.into())),
None => GetRoleResponse::NotFound,
})
}
Expand All @@ -152,7 +150,8 @@ impl DetailApi {
let Some(role) = Role::Entity::find_by_id(id.0)
.one(&*db)
.await
.map_err(poem::error::InternalServerError)? else {
.map_err(poem::error::InternalServerError)?
else {
return Ok(UpdateRoleResponse::NotFound);
};

Expand Down Expand Up @@ -181,7 +180,8 @@ impl DetailApi {
let Some(role) = Role::Entity::find_by_id(id.0)
.one(&*db)
.await
.map_err(poem::error::InternalServerError)? else {
.map_err(poem::error::InternalServerError)?
else {
return Ok(DeleteRoleResponse::NotFound);
};

Expand Down
4 changes: 1 addition & 3 deletions warpgate-common/src/eventhub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ impl<E> Clone for EventSender<E> {
impl<E> EventSender<E> {
async fn cleanup_subscriptions(&self) -> MutexGuard<'_, SubscriptionStoreInner<E>> {
let mut subscriptions = self.subscriptions.lock().await;
subscriptions
.drain_filter(|(_, ref s)| s.is_closed())
.for_each(drop);
subscriptions.retain(|(_, ref s)| !s.is_closed());
subscriptions
}
}
Expand Down
3 changes: 1 addition & 2 deletions warpgate-common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(drain_filter, duration_constants)]
#![feature(duration_constants)]
pub mod auth;
mod config;
pub mod consts;
Expand All @@ -12,5 +12,4 @@ mod types;
pub use config::*;
pub use error::WarpgateError;
pub use tls::*;
pub use try_macro::*;
pub use types::*;
2 changes: 1 addition & 1 deletion warpgate-core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(drain_filter, duration_constants, try_blocks)]
#![feature(duration_constants, try_blocks)]
pub mod consts;
mod data;
mod state;
Expand Down
5 changes: 1 addition & 4 deletions warpgate-core/src/logging/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ fn values_to_log_entry_data(mut values: SerializedRecordValues) -> Option<LogEnt
let message = (*values).remove("message").unwrap_or_default();

use sea_orm::ActiveValue::Set;
let session_id = session_id.and_then(|x| Uuid::parse_str(&x).ok());
let Some(session_id) = session_id else {
return None
};
let session_id = session_id.and_then(|x| Uuid::parse_str(&x).ok())?;

Some(LogEntry::ActiveModel {
id: Set(Uuid::new_v4()),
Expand Down
9 changes: 2 additions & 7 deletions warpgate-core/src/recordings/terminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,14 @@ pub enum AsciiCast {
Output(f32, String, String),
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Default)]
pub enum TerminalRecordingStreamId {
Input,
#[default]
Output,
Error,
}

impl Default for TerminalRecordingStreamId {
fn default() -> Self {
TerminalRecordingStreamId::Output
}
}

#[derive(Serialize, Deserialize, Debug)]
#[serde(untagged)]
pub enum TerminalRecordingItem {
Expand Down
2 changes: 1 addition & 1 deletion warpgate-protocol-http/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ fn copy_client_response<R: SomeResponse>(
}
}
}
server_response.headers_mut().extend(headers.into_iter());
server_response.headers_mut().extend(headers);

server_response.set_status(client_response.status());
}
Expand Down
6 changes: 3 additions & 3 deletions warpgate-protocol-ssh/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ use uuid::Uuid;
use warpgate_common::{ProtocolName, SshHostKeyVerificationMode, Target, TargetOptions};
use warpgate_core::{ProtocolServer, Services, TargetTestError};

use crate::client::{RCCommand, RemoteClient};

pub static PROTOCOL_NAME: ProtocolName = "SSH";

#[derive(Clone)]
Expand All @@ -48,7 +46,9 @@ impl ProtocolServer for SSHProtocolServer {

async fn test_target(&self, target: Target) -> Result<(), TargetTestError> {
let TargetOptions::Ssh(ssh_options) = target.options else {
return Err(TargetTestError::Misconfigured("Not an SSH target".to_owned()));
return Err(TargetTestError::Misconfigured(
"Not an SSH target".to_owned(),
));
};

let mut handles = RemoteClient::create(Uuid::new_v4(), self.services.clone())?;
Expand Down

0 comments on commit 2d6621f

Please sign in to comment.