From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <pbs-devel-bounces@lists.proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id E00951FF168 for <inbox@lore.proxmox.com>; Tue, 4 Mar 2025 15:41:32 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E9E1B1CB1; Tue, 4 Mar 2025 15:41:25 +0100 (CET) From: Maximiliano Sandoval <m.sandoval@proxmox.com> To: pbs-devel@lists.proxmox.com Date: Tue, 4 Mar 2025 15:40:48 +0100 Message-Id: <20250304144051.585163-6-m.sandoval@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250304144051.585163-1-m.sandoval@proxmox.com> References: <20250304144051.585163-1-m.sandoval@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.100 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox 6/9] port to edition 2024 X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion <pbs-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/> List-Post: <mailto:pbs-devel@lists.proxmox.com> List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe> Reply-To: Proxmox Backup Server development discussion <pbs-devel@lists.proxmox.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" <pbs-devel-bounces@lists.proxmox.com> We remove binding modifiers as per: error: binding modifiers may only be written when the default binding mode is `move` --> proxmox-schema/src/format.rs:247:24 | 247 | Schema::Number(ref schema) => ( | ^^^ binding modifier not allowed under `ref` default binding mode | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> note: matching on a reference type with a non-reference pattern changes the default binding mode These change are possible thanks to the new match ergonomics so they cannot be split into a separate commit. Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com> --- Cargo.toml | 4 +-- proxmox-acme-api/src/plugin_api_impl.rs | 4 +-- proxmox-api-macro/src/api/method.rs | 8 +++--- proxmox-api-macro/src/api/structs.rs | 2 +- proxmox-async/src/io/async_channel_writer.rs | 2 +- proxmox-http/src/client/tls.rs | 30 ++++++++++---------- proxmox-http/src/rate_limited_stream.rs | 2 +- proxmox-http/src/websocket/mod.rs | 2 +- proxmox-notify/src/endpoints/smtp.rs | 2 +- proxmox-router/src/cli/command.rs | 8 +++--- proxmox-router/src/permission.rs | 4 +-- proxmox-router/src/stream/parsing.rs | 5 +--- proxmox-schema/src/format.rs | 16 +++++------ proxmox-schema/src/schema.rs | 6 ++-- rustfmt.toml | 2 +- 15 files changed, 47 insertions(+), 50 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3d758e92..794b448b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,12 +57,12 @@ resolver = "2" [workspace.package] authors = ["Proxmox Support Team <support@proxmox.com>"] -edition = "2021" +edition = "2024" license = "AGPL-3" repository = "https://git.proxmox.com/?p=proxmox.git" homepage = "https://proxmox.com" exclude = [ "debian" ] -rust-version = "1.82" +rust-version = "1.85" [workspace.dependencies] # any features enabled here are enabled on all members using 'workspace = true'! diff --git a/proxmox-acme-api/src/plugin_api_impl.rs b/proxmox-acme-api/src/plugin_api_impl.rs index 9aa8a4c3..6c2403e4 100644 --- a/proxmox-acme-api/src/plugin_api_impl.rs +++ b/proxmox-acme-api/src/plugin_api_impl.rs @@ -83,7 +83,7 @@ pub fn update_plugin( expected_digest.detect_modification(digest.as_ref())?; match plugins.get_mut(&id) { - Some((ty, ref mut entry)) => { + Some((ty, entry)) => { if ty != "dns" { bail!("cannot update plugin of type {:?}", ty); } @@ -150,7 +150,7 @@ fn modify_cfg_for_api(id: &str, ty: &str, data: &Value) -> PluginConfig { // None of these should be able to fail unless the user changed the files by hand, in which // case we leave the unmodified string in the Value for now. This will be handled with an error // later. - if let Some(Value::String(ref mut data)) = obj.get_mut("data") { + if let Some(Value::String(data)) = obj.get_mut("data") { if let Ok(new) = base64::decode_config(&data, base64::URL_SAFE_NO_PAD) { if let Ok(utf8) = String::from_utf8(new) { *data = utf8; diff --git a/proxmox-api-macro/src/api/method.rs b/proxmox-api-macro/src/api/method.rs index bc2c2e4f..cca07145 100644 --- a/proxmox-api-macro/src/api/method.rs +++ b/proxmox-api-macro/src/api/method.rs @@ -30,7 +30,7 @@ pub enum ReturnType { impl ReturnType { fn as_mut_schema(&mut self) -> Option<&mut Schema> { match self { - ReturnType::Explicit(ReturnSchema { ref mut schema, .. }) => Some(schema), + ReturnType::Explicit(ReturnSchema { schema, .. }) => Some(schema), _ => None, } } @@ -582,7 +582,7 @@ fn create_wrapper_function( let body = match method_info.flavor { MethodFlavor::Normal => { quote! { - if let ::serde_json::Value::Object(ref mut input_map) = &mut input_params { + if let ::serde_json::Value::Object(input_map) = &mut input_params { #body Ok(::serde_json::to_value(#func_name(#args) #await_keyword #question_mark)?) } else { @@ -592,7 +592,7 @@ fn create_wrapper_function( } MethodFlavor::Serializing => { quote! { - if let ::serde_json::Value::Object(ref mut input_map) = &mut input_params { + if let ::serde_json::Value::Object(input_map) = &mut input_params { #body let res = #func_name(#args) #await_keyword #question_mark; let res: ::std::boxed::Box<dyn ::proxmox_router::SerializableReturn + Send> = ::std::boxed::Box::new(res); @@ -609,7 +609,7 @@ fn create_wrapper_function( quote! { ::proxmox_router::SyncStream } }; quote! { - if let ::serde_json::Value::Object(ref mut input_map) = &mut input_params { + if let ::serde_json::Value::Object(input_map) = &mut input_params { #body let res = #func_name(#args) #await_keyword #question_mark; let res = #ty::from(res); diff --git a/proxmox-api-macro/src/api/structs.rs b/proxmox-api-macro/src/api/structs.rs index ee537ff0..c18b20b4 100644 --- a/proxmox-api-macro/src/api/structs.rs +++ b/proxmox-api-macro/src/api/structs.rs @@ -164,7 +164,7 @@ fn handle_regular_struct( let mut all_of_schemas = TokenStream::new(); let mut to_remove = Vec::new(); - if let syn::Fields::Named(ref fields) = &stru.fields { + if let syn::Fields::Named(fields) = &stru.fields { for field in &fields.named { let attrs = serde::FieldAttrib::try_from(&field.attrs[..])?; diff --git a/proxmox-async/src/io/async_channel_writer.rs b/proxmox-async/src/io/async_channel_writer.rs index 9dd64cd5..d9de8e27 100644 --- a/proxmox-async/src/io/async_channel_writer.rs +++ b/proxmox-async/src/io/async_channel_writer.rs @@ -76,7 +76,7 @@ impl AsyncChannelWriter { self.state = WriterState::Sending(future.boxed()); } - WriterState::Sending(ref mut future) => match ready!(future.as_mut().poll(cx)) { + WriterState::Sending(future) => match ready!(future.as_mut().poll(cx)) { Ok(sender) => { self.sender = Some(sender); self.state = WriterState::Ready; diff --git a/proxmox-http/src/client/tls.rs b/proxmox-http/src/client/tls.rs index 81aff783..867017e8 100644 --- a/proxmox-http/src/client/tls.rs +++ b/proxmox-http/src/client/tls.rs @@ -24,9 +24,9 @@ impl<S: AsyncRead + AsyncWrite + Unpin> AsyncRead for MaybeTlsStream<S> { buf: &mut ReadBuf, ) -> Poll<Result<(), io::Error>> { match self.get_mut() { - MaybeTlsStream::Normal(ref mut s) => Pin::new(s).poll_read(cx, buf), - MaybeTlsStream::Proxied(ref mut s) => Pin::new(s).poll_read(cx, buf), - MaybeTlsStream::Secured(ref mut s) => Pin::new(s).poll_read(cx, buf), + MaybeTlsStream::Normal(s) => Pin::new(s).poll_read(cx, buf), + MaybeTlsStream::Proxied(s) => Pin::new(s).poll_read(cx, buf), + MaybeTlsStream::Secured(s) => Pin::new(s).poll_read(cx, buf), } } } @@ -38,9 +38,9 @@ impl<S: AsyncRead + AsyncWrite + Unpin> AsyncWrite for MaybeTlsStream<S> { buf: &[u8], ) -> Poll<Result<usize, io::Error>> { match self.get_mut() { - MaybeTlsStream::Normal(ref mut s) => Pin::new(s).poll_write(cx, buf), - MaybeTlsStream::Proxied(ref mut s) => Pin::new(s).poll_write(cx, buf), - MaybeTlsStream::Secured(ref mut s) => Pin::new(s).poll_write(cx, buf), + MaybeTlsStream::Normal(s) => Pin::new(s).poll_write(cx, buf), + MaybeTlsStream::Proxied(s) => Pin::new(s).poll_write(cx, buf), + MaybeTlsStream::Secured(s) => Pin::new(s).poll_write(cx, buf), } } @@ -50,9 +50,9 @@ impl<S: AsyncRead + AsyncWrite + Unpin> AsyncWrite for MaybeTlsStream<S> { bufs: &[io::IoSlice<'_>], ) -> Poll<Result<usize, io::Error>> { match self.get_mut() { - MaybeTlsStream::Normal(ref mut s) => Pin::new(s).poll_write_vectored(cx, bufs), - MaybeTlsStream::Proxied(ref mut s) => Pin::new(s).poll_write_vectored(cx, bufs), - MaybeTlsStream::Secured(ref mut s) => Pin::new(s).poll_write_vectored(cx, bufs), + MaybeTlsStream::Normal(s) => Pin::new(s).poll_write_vectored(cx, bufs), + MaybeTlsStream::Proxied(s) => Pin::new(s).poll_write_vectored(cx, bufs), + MaybeTlsStream::Secured(s) => Pin::new(s).poll_write_vectored(cx, bufs), } } @@ -66,17 +66,17 @@ impl<S: AsyncRead + AsyncWrite + Unpin> AsyncWrite for MaybeTlsStream<S> { fn poll_flush(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Result<(), io::Error>> { match self.get_mut() { - MaybeTlsStream::Normal(ref mut s) => Pin::new(s).poll_flush(cx), - MaybeTlsStream::Proxied(ref mut s) => Pin::new(s).poll_flush(cx), - MaybeTlsStream::Secured(ref mut s) => Pin::new(s).poll_flush(cx), + MaybeTlsStream::Normal(s) => Pin::new(s).poll_flush(cx), + MaybeTlsStream::Proxied(s) => Pin::new(s).poll_flush(cx), + MaybeTlsStream::Secured(s) => Pin::new(s).poll_flush(cx), } } fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Result<(), io::Error>> { match self.get_mut() { - MaybeTlsStream::Normal(ref mut s) => Pin::new(s).poll_shutdown(cx), - MaybeTlsStream::Proxied(ref mut s) => Pin::new(s).poll_shutdown(cx), - MaybeTlsStream::Secured(ref mut s) => Pin::new(s).poll_shutdown(cx), + MaybeTlsStream::Normal(s) => Pin::new(s).poll_shutdown(cx), + MaybeTlsStream::Proxied(s) => Pin::new(s).poll_shutdown(cx), + MaybeTlsStream::Secured(s) => Pin::new(s).poll_shutdown(cx), } } } diff --git a/proxmox-http/src/rate_limited_stream.rs b/proxmox-http/src/rate_limited_stream.rs index d43c09c1..0e9c43ae 100644 --- a/proxmox-http/src/rate_limited_stream.rs +++ b/proxmox-http/src/rate_limited_stream.rs @@ -116,7 +116,7 @@ fn register_traffic(limiter: &(dyn ShareableRateLimit), count: usize) -> Option< fn delay_is_ready(delay: &mut Option<Pin<Box<Sleep>>>, ctx: &mut Context<'_>) -> bool { match delay { - Some(ref mut future) => future.as_mut().poll(ctx).is_ready(), + Some(future) => future.as_mut().poll(ctx).is_ready(), None => true, } } diff --git a/proxmox-http/src/websocket/mod.rs b/proxmox-http/src/websocket/mod.rs index eef5fa8e..fdbec979 100644 --- a/proxmox-http/src/websocket/mod.rs +++ b/proxmox-http/src/websocket/mod.rs @@ -548,7 +548,7 @@ impl<R: AsyncRead + Unpin + Send + 'static> AsyncRead for WebSocketReader<R> { this.state = ReaderState::Receiving(future.boxed()); } - ReaderState::Receiving(ref mut future) => match ready!(future.as_mut().poll(cx)) { + ReaderState::Receiving(future) => match ready!(future.as_mut().poll(cx)) { Ok(ReadResult { len, reader, diff --git a/proxmox-notify/src/endpoints/smtp.rs b/proxmox-notify/src/endpoints/smtp.rs index b88e6c95..4521e04a 100644 --- a/proxmox-notify/src/endpoints/smtp.rs +++ b/proxmox-notify/src/endpoints/smtp.rs @@ -251,7 +251,7 @@ impl Endpoint for SmtpEndpoint { .map_err(|err| Error::NotifyFailed(self.name().into(), Box::new(err)))? } #[cfg(feature = "mail-forwarder")] - Content::ForwardedMail { ref raw, title, .. } => { + Content::ForwardedMail { raw, title, .. } => { use lettre::message::header::ContentTransferEncoding; use lettre::message::Body; use tracing::error; diff --git a/proxmox-router/src/cli/command.rs b/proxmox-router/src/cli/command.rs index 01f64d19..aa99d528 100644 --- a/proxmox-router/src/cli/command.rs +++ b/proxmox-router/src/cli/command.rs @@ -327,10 +327,10 @@ pub async fn handle_command_future( set_help_context(Some(def.clone())); let result = match &*def { - CommandLineInterface::Simple(ref cli_cmd) => { + CommandLineInterface::Simple(cli_cmd) => { handle_simple_command_future(prefix, cli_cmd, args, rpcenv).await } - CommandLineInterface::Nested(ref map) => { + CommandLineInterface::Nested(map) => { let mut prefix = prefix.to_string(); let cli_cmd = parse_nested_command(&mut prefix, map, &mut args)?; handle_simple_command_future(&prefix, cli_cmd, args, rpcenv).await @@ -356,10 +356,10 @@ pub fn handle_command( set_help_context(Some(def.clone())); let result = match &*def { - CommandLineInterface::Simple(ref cli_cmd) => { + CommandLineInterface::Simple(cli_cmd) => { handle_simple_command(prefix, cli_cmd, args, &mut rpcenv, run, [].into_iter()) } - CommandLineInterface::Nested(ref map) => { + CommandLineInterface::Nested(map) => { let mut prefix = prefix.to_string(); let cli_cmd = parse_nested_command(&mut prefix, map, &mut args)?; handle_simple_command(&prefix, cli_cmd, args, &mut rpcenv, run, [].into_iter()) diff --git a/proxmox-router/src/permission.rs b/proxmox-router/src/permission.rs index d3767b51..f6388d64 100644 --- a/proxmox-router/src/permission.rs +++ b/proxmox-router/src/permission.rs @@ -38,9 +38,9 @@ impl fmt::Debug for Permission { Permission::Superuser => f.write_str("Superuser"), Permission::World => f.write_str("World"), Permission::Anybody => f.write_str("Anybody"), - Permission::User(ref userid) => write!(f, "User({})", userid), + Permission::User(userid) => write!(f, "User({})", userid), Permission::UserParam(param_name) => write!(f, "UserParam({})", param_name), - Permission::Group(ref group) => write!(f, "Group({})", group), + Permission::Group(group) => write!(f, "Group({})", group), Permission::WithParam(param_name, subtest) => { write!(f, "WithParam({}, {:?})", param_name, subtest) } diff --git a/proxmox-router/src/stream/parsing.rs b/proxmox-router/src/stream/parsing.rs index 69ae1994..782c18a6 100644 --- a/proxmox-router/src/stream/parsing.rs +++ b/proxmox-router/src/stream/parsing.rs @@ -270,10 +270,7 @@ impl AsyncBufRead for BodyBufReader { ) -> Poll<io::Result<&[u8]>> { use hyper::body::HttpBody; - let Self { - ref mut reader, - ref mut buf_at, - } = Pin::into_inner(self); + let Self { reader, buf_at } = Pin::into_inner(self); loop { // If we currently have a buffer, use it: if let Some((buf, at)) = buf_at { diff --git a/proxmox-schema/src/format.rs b/proxmox-schema/src/format.rs index 080b0268..c1e33a68 100644 --- a/proxmox-schema/src/format.rs +++ b/proxmox-schema/src/format.rs @@ -229,30 +229,30 @@ pub fn get_property_description( let (descr, default, extra) = match schema { Schema::Null => ("null", None, None), - Schema::String(ref schema) => ( + Schema::String(schema) => ( schema.description, schema.default.map(|v| v.to_owned()), None, ), - Schema::Boolean(ref schema) => ( + Schema::Boolean(schema) => ( schema.description, schema.default.map(|v| v.to_string()), None, ), - Schema::Integer(ref schema) => ( + Schema::Integer(schema) => ( schema.description, schema.default.map(|v| v.to_string()), None, ), - Schema::Number(ref schema) => ( + Schema::Number(schema) => ( schema.description, schema.default.map(|v| v.to_string()), None, ), - Schema::Object(ref schema) => (schema.description, None, None), - Schema::AllOf(ref schema) => (schema.description, None, None), - Schema::OneOf(ref schema) => (schema.description, None, None), - Schema::Array(ref schema) => ( + Schema::Object(schema) => (schema.description, None, None), + Schema::AllOf(schema) => (schema.description, None, None), + Schema::OneOf(schema) => (schema.description, None, None), + Schema::Array(schema) => ( schema.description, None, Some(String::from("Can be specified more than once.")), diff --git a/proxmox-schema/src/schema.rs b/proxmox-schema/src/schema.rs index ddbbacd4..df87e070 100644 --- a/proxmox-schema/src/schema.rs +++ b/proxmox-schema/src/schema.rs @@ -595,7 +595,7 @@ impl ArraySchema { /// Verify JSON value using an `ArraySchema`. pub fn verify_json(&self, data: &Value) -> Result<(), Error> { let list = match data { - Value::Array(ref list) => list, + Value::Array(list) => list, Value::Object(_) => bail!("Expected array - got object."), _ => bail!("Expected array - got scalar value."), }; @@ -1078,7 +1078,7 @@ pub trait ObjectSchemaType: private::Sealed + Send + Sync { /// Verify JSON value using an object schema. fn verify_json(&self, data: &Value) -> Result<(), Error> { let map = match data { - Value::Object(ref map) => map, + Value::Object(map) => map, Value::Array(_) => bail!("Expected object - got array."), _ => bail!("Expected object - got scalar value."), }; @@ -1272,7 +1272,7 @@ impl ObjectSchemaType for OneOfSchema { fn verify_json(&self, data: &Value) -> Result<(), Error> { let map = match data { - Value::Object(ref map) => map, + Value::Object(map) => map, Value::Array(_) => bail!("Expected object - got array."), _ => bail!("Expected object - got scalar value."), }; diff --git a/rustfmt.toml b/rustfmt.toml index 3a26366d..f216078d 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1 +1 @@ -edition = "2021" +edition = "2024" -- 2.39.5 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel