mirror of
https://github.com/warp-tech/warpgate.git
synced 2024-09-20 06:46:17 +08:00
bumped rust
This commit is contained in:
parent
d58f0917a1
commit
eb13e71fb3
|
@ -1 +1 @@
|
|||
nightly-2022-10-01
|
||||
nightly-2023-01-11
|
||||
|
|
|
@ -35,7 +35,7 @@ impl<T: ParseFromJSON + ToJSON + Send + Sync> PaginatedResponse<T> {
|
|||
let total = paginator
|
||||
.num_items()
|
||||
.await
|
||||
.map_err(poem::error::InternalServerError)? as u64;
|
||||
.map_err(poem::error::InternalServerError)?;
|
||||
|
||||
let query = query.offset(offset).limit(limit);
|
||||
|
||||
|
|
|
@ -13,5 +13,5 @@ pub fn main() {
|
|||
let re = Regex::new(r"PaginatedResponse<(?P<name>\w+)>").unwrap();
|
||||
let spec = re.replace_all(&spec, "Paginated$name");
|
||||
|
||||
println!("{}", spec);
|
||||
println!("{spec}");
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ impl Debug for AuthSelector {
|
|||
AuthSelector::User {
|
||||
username,
|
||||
target_name,
|
||||
} => write!(f, "<{} for {}>", username, target_name),
|
||||
} => write!(f, "<{username} for {target_name}>"),
|
||||
AuthSelector::Ticket { .. } => write!(f, "<ticket>"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ macro_rules! try_block {
|
|||
|
||||
#[test]
|
||||
#[allow(clippy::assertions_on_constants)]
|
||||
#[allow(clippy::unwrap_used)]
|
||||
fn test_catch() {
|
||||
let mut caught = false;
|
||||
try_block!({
|
||||
|
|
|
@ -179,7 +179,7 @@ impl ConfigProvider for DatabaseConfigProvider {
|
|||
} => {
|
||||
let base64_bytes = BASE64.encode(public_key_bytes);
|
||||
|
||||
let client_key = format!("{} {}", kind, base64_bytes);
|
||||
let client_key = format!("{kind} {base64_bytes}");
|
||||
debug!(username = &user.username[..], "Client key: {}", client_key);
|
||||
|
||||
return Ok(user.credentials.iter().any(|credential| match credential {
|
||||
|
|
|
@ -180,7 +180,7 @@ impl ConfigProvider for FileConfigProvider {
|
|||
} => {
|
||||
let base64_bytes = BASE64.encode(public_key_bytes);
|
||||
|
||||
let client_key = format!("{} {}", kind, base64_bytes);
|
||||
let client_key = format!("{kind} {base64_bytes}");
|
||||
debug!(username = &user.username[..], "Client key: {}", client_key);
|
||||
|
||||
return Ok(user.credentials.iter().any(|credential| match credential {
|
||||
|
|
|
@ -19,7 +19,7 @@ where
|
|||
if socket_address.is_some() {
|
||||
socket = UnixDatagram::unbound()
|
||||
.map_err(|error| {
|
||||
println!("Failed to create the log forwarding UDP socket: {}", error);
|
||||
println!("Failed to create the log forwarding UDP socket: {error}");
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
|
|
|
@ -51,6 +51,6 @@ impl<'a> Visit for RecordVisitor<'a> {
|
|||
}
|
||||
|
||||
fn record_debug(&mut self, field: &Field, value: &dyn Debug) {
|
||||
self.values.insert(field.name(), format!("{:?}", value));
|
||||
self.values.insert(field.name(), format!("{value:?}"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,6 +114,7 @@ impl RecordingWriter {
|
|||
|
||||
impl Drop for RecordingWriter {
|
||||
fn drop(&mut self) {
|
||||
let _ = self.drop_signal.send(());
|
||||
let signal = std::mem::replace(&mut self.drop_signal, mpsc::channel(1).0);
|
||||
tokio::spawn(async move { signal.send(()).await });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ impl FromStr for CharSet {
|
|||
|
||||
_ => {
|
||||
return Err(Error::Configuration(
|
||||
format!("unsupported MySQL charset: {}", char_set).into(),
|
||||
format!("unsupported MySQL charset: {char_set}").into(),
|
||||
));
|
||||
}
|
||||
})
|
||||
|
@ -893,7 +893,7 @@ impl FromStr for Collation {
|
|||
|
||||
_ => {
|
||||
return Err(Error::Configuration(
|
||||
format!("unsupported MySQL collation: {}", collation).into(),
|
||||
format!("unsupported MySQL collation: {collation}").into(),
|
||||
));
|
||||
}
|
||||
})
|
||||
|
|
|
@ -126,6 +126,7 @@ impl Encode<'_, ()> for Handshake {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[allow(clippy::unwrap_used)]
|
||||
fn test_decode_handshake_mysql_8_0_18() {
|
||||
const HANDSHAKE_MYSQL_8_0_18: &[u8] = b"\n8.0.18\x00\x19\x00\x00\x00\x114aB0c\x06g\x00\xff\xff\xff\x02\x00\xff\xc7\x15\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00tL\x03s\x0f[4\rl4. \x00caching_sha2_password\x00";
|
||||
|
||||
|
@ -180,6 +181,7 @@ fn test_decode_handshake_mysql_8_0_18() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[allow(clippy::unwrap_used)]
|
||||
fn test_decode_handshake_mariadb_10_4_7() {
|
||||
const HANDSHAKE_MARIA_DB_10_4_7: &[u8] = b"\n5.5.5-10.4.7-MariaDB-1:10.4.7+maria~bionic\x00\x0b\x00\x00\x00t6L\\j\"dS\x00\xfe\xf7\x08\x02\x00\xff\x81\x15\x00\x00\x00\x00\x00\x00\x07\x00\x00\x00U14Oph9\"<H5n\x00mysql_native_password\x00";
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ impl Encode<'_, ()> for ErrPacket {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[allow(clippy::unwrap_used)]
|
||||
fn test_decode_err_packet_out_of_order() {
|
||||
const ERR_PACKETS_OUT_OF_ORDER: &[u8] = b"\xff\x84\x04Got packets out of order";
|
||||
|
||||
|
@ -69,6 +70,7 @@ fn test_decode_err_packet_out_of_order() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[allow(clippy::unwrap_used)]
|
||||
fn test_decode_err_packet_unknown_database() {
|
||||
const ERR_HANDSHAKE_UNKNOWN_DB: &[u8] = b"\xff\x19\x04#42000Unknown database \'unknown\'";
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ impl Encode<'_, ()> for OkPacket {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[allow(clippy::unwrap_used)]
|
||||
fn test_decode_ok_packet() {
|
||||
const DATA: &[u8] = b"\x00\x00\x00\x02@\x00\x00";
|
||||
|
||||
|
|
|
@ -12,6 +12,6 @@ impl Row {
|
|||
pub(crate) fn get(&self, index: usize) -> Option<&[u8]> {
|
||||
self.values[index]
|
||||
.as_ref()
|
||||
.map(|col| &self.storage[(col.start as usize)..(col.end as usize)])
|
||||
.map(|col| &self.storage[col.start..col.end])
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ impl ProtocolServer for HTTPProtocolServer {
|
|||
let spec = api_service.spec_endpoint();
|
||||
|
||||
let session_storage =
|
||||
SharedSessionStorage(Arc::new(Mutex::new(Box::new(MemoryStorage::default()))));
|
||||
SharedSessionStorage(Arc::new(Mutex::new(Box::<MemoryStorage>::default())));
|
||||
let session_store = SessionStore::new();
|
||||
|
||||
let cache_bust = || {
|
||||
|
|
|
@ -13,5 +13,5 @@ pub fn main() {
|
|||
let re = Regex::new(r"PaginatedResponse<(?P<name>\w+)>").unwrap();
|
||||
let spec = re.replace_all(&spec, "Paginated$name");
|
||||
|
||||
println!("{}", spec);
|
||||
println!("{spec}");
|
||||
}
|
||||
|
|
|
@ -314,14 +314,11 @@ async fn copy_client_body_and_embed(
|
|||
script_manifest.file
|
||||
);
|
||||
for css_file in script_manifest.css.unwrap_or_default() {
|
||||
inject += &format!(
|
||||
r#"<link rel="stylesheet" href="/@warpgate/{}" />"#,
|
||||
css_file
|
||||
);
|
||||
inject += &format!(r#"<link rel="stylesheet" href="/@warpgate/{css_file}" />"#,);
|
||||
}
|
||||
|
||||
let before = "</head>";
|
||||
let content = content.replacen(before, &format!("{}{}", inject, before), 1);
|
||||
let content = content.replacen(before, &format!("{inject}{before}"), 1);
|
||||
|
||||
response.headers_mut().remove(http::header::CONTENT_LENGTH);
|
||||
response
|
||||
|
|
|
@ -154,8 +154,7 @@ impl MySqlClient {
|
|||
} else if response.first() == Some(&0xff) {
|
||||
let error = ErrPacket::decode_with(response, options.capabilities)?;
|
||||
return Err(MySqlError::ProtocolError(format!(
|
||||
"handshake failed: {:?}",
|
||||
error
|
||||
"handshake failed: {error:?}"
|
||||
)));
|
||||
} else {
|
||||
return Err(MySqlError::ProtocolError(format!(
|
||||
|
|
|
@ -100,16 +100,13 @@ impl ProtocolServer for SSHProtocolServer {
|
|||
} = err
|
||||
{
|
||||
println!("\n");
|
||||
println!("Stored key ({}): {}", known_key_type, known_key_base64);
|
||||
println!(
|
||||
"Received key ({}): {}",
|
||||
received_key_type, received_key_base64
|
||||
);
|
||||
println!("Stored key ({known_key_type}): {known_key_base64}");
|
||||
println!("Received key ({received_key_type}): {received_key_base64}");
|
||||
println!("Host key doesn't match the stored one.");
|
||||
println!("If you know that the key is correct (e.g. it has been changed),");
|
||||
println!("you can remove the old key in the Warpgate management UI and try again");
|
||||
}
|
||||
return Err(TargetTestError::ConnectionError(format!("{:?}", err)));
|
||||
return Err(TargetTestError::ConnectionError(format!("{err:?}")));
|
||||
}
|
||||
RCEvent::State(state) => match state {
|
||||
RCState::Connected => {
|
||||
|
|
|
@ -38,7 +38,7 @@ impl ServiceOutput {
|
|||
tick_index = (tick_index + 1) % ticks.len();
|
||||
#[allow(clippy::indexing_slicing)]
|
||||
let tick = ticks[tick_index];
|
||||
let badge = Colour::Black.on(Colour::Blue).paint(format!(" {} Warpgate connecting ", tick)).to_string();
|
||||
let badge = Colour::Black.on(Colour::Blue).paint(format!(" {tick} Warpgate connecting ")).to_string();
|
||||
let _ = output_tx.send(Bytes::from([ERASE_PROGRESS_SPINNER_BUF, badge.as_bytes()].concat()));
|
||||
}
|
||||
}
|
||||
|
@ -77,6 +77,7 @@ impl ServiceOutput {
|
|||
|
||||
impl Drop for ServiceOutput {
|
||||
fn drop(&mut self) {
|
||||
let _ = self.abort_tx.send(());
|
||||
let signal = std::mem::replace(&mut self.abort_tx, mpsc::channel(1).0);
|
||||
tokio::spawn(async move { signal.send(()).await });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ pub struct ServerSession {
|
|||
}
|
||||
|
||||
fn session_debug_tag(id: &SessionId, remote_address: &SocketAddr) -> String {
|
||||
format!("[{} - {}]", id, remote_address)
|
||||
format!("[{id} - {remote_address}]")
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for ServerSession {
|
||||
|
@ -169,7 +169,7 @@ impl ServerSession {
|
|||
}
|
||||
});
|
||||
|
||||
let name = format!("SSH {} session control", id);
|
||||
let name = format!("SSH {id} session control");
|
||||
tokio::task::Builder::new().name(&name).spawn({
|
||||
let sender = event_sender.clone();
|
||||
async move {
|
||||
|
@ -181,7 +181,7 @@ impl ServerSession {
|
|||
}
|
||||
});
|
||||
|
||||
let name = format!("SSH {} client events", id);
|
||||
let name = format!("SSH {id} client events");
|
||||
tokio::task::Builder::new().name(&name).spawn({
|
||||
let sender = event_sender.clone();
|
||||
async move {
|
||||
|
@ -193,7 +193,7 @@ impl ServerSession {
|
|||
}
|
||||
});
|
||||
|
||||
let name = format!("SSH {} server handler events", id);
|
||||
let name = format!("SSH {id} server handler events");
|
||||
tokio::task::Builder::new().name(&name).spawn({
|
||||
let sender = event_sender.clone();
|
||||
async move {
|
||||
|
@ -1124,7 +1124,7 @@ impl ServerSession {
|
|||
) -> Result<()> {
|
||||
let channel_id = self.map_channel(&server_channel_id)?;
|
||||
debug!(channel=%server_channel_id.0, ?data, "Data");
|
||||
let _ = self.send_command_and_wait(RCCommand::Channel(
|
||||
let _ = self.send_command(RCCommand::Channel(
|
||||
channel_id,
|
||||
ChannelOperation::ExtendedData { ext: code, data },
|
||||
));
|
||||
|
|
|
@ -17,7 +17,7 @@ pub async fn make_client(config: &SsoInternalProviderConfig) -> Result<CoreClien
|
|||
.await
|
||||
.map_err(|e| {
|
||||
SsoError::Discovery(match e {
|
||||
DiscoveryError::Request(inner) => format!("Request error: {}", inner),
|
||||
DiscoveryError::Request(inner) => format!("Request error: {inner}"),
|
||||
e => format!("{e}"),
|
||||
})
|
||||
})?;
|
||||
|
|
|
@ -28,7 +28,7 @@ use crate::Commands;
|
|||
fn prompt_endpoint(prompt: &str, default: ListenEndpoint) -> ListenEndpoint {
|
||||
loop {
|
||||
let v = dialoguer::Input::with_theme(&ColorfulTheme::default())
|
||||
.default(format!("{:?}", default))
|
||||
.default(format!("{default:?}"))
|
||||
.with_prompt(prompt)
|
||||
.interact_text()
|
||||
.and_then(|v| v.to_socket_addrs());
|
||||
|
@ -257,7 +257,7 @@ pub(crate) async fn command(cli: &crate::Cli) -> Result<()> {
|
|||
|
||||
info!("Generated configuration:");
|
||||
let yaml = serde_yaml::to_string(&store)?;
|
||||
println!("{}", yaml);
|
||||
println!("{yaml}");
|
||||
|
||||
File::create(&cli.config)?.write_all(yaml.as_bytes())?;
|
||||
info!("Saved into {}", cli.config.display());
|
||||
|
|
Loading…
Reference in a new issue