mirror of
https://github.com/vinezombie/vinezombie.git
synced 2026-01-24 23:17:34 +00:00
Adjust and fix lints
This commit is contained in:
@@ -1 +1,3 @@
|
||||
msrv = "1.70.0"
|
||||
semicolon-inside-block-ignore-singleline = true
|
||||
semicolon-outside-block-ignore-multiline = true
|
||||
|
||||
@@ -51,9 +51,7 @@ unsafe impl<T> Sync for Sender<T> {}
|
||||
|
||||
impl<T> Clone for Sender<T> {
|
||||
fn clone(&self) -> Self {
|
||||
unsafe {
|
||||
self.0.as_ref().sender_count.fetch_add(1, Ordering::Relaxed);
|
||||
}
|
||||
unsafe { self.0.as_ref().sender_count.fetch_add(1, Ordering::Relaxed) };
|
||||
Self(self.0)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,9 +106,7 @@ fn load_pem(path: &Path, certs: &mut RootCertStore) -> std::io::Result<()> {
|
||||
let mut file = std::io::BufReader::new(std::fs::File::open(path)?);
|
||||
for cert in rustls_pemfile::certs(&mut file) {
|
||||
let cert = cert?;
|
||||
certs
|
||||
.add(CertificateDer::from(cert))
|
||||
.map_err(|e| std::io::Error::new(std::io::ErrorKind::InvalidData, e))?;
|
||||
certs.add(cert).map_err(|e| std::io::Error::new(std::io::ErrorKind::InvalidData, e))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -121,9 +119,7 @@ fn load_client_cert(
|
||||
let mut file = std::io::BufReader::new(std::fs::File::open(path)?);
|
||||
while let Some(item) = rustls_pemfile::read_one(&mut file)? {
|
||||
match item {
|
||||
rustls_pemfile::Item::X509Certificate(c) => {
|
||||
certs.push(CertificateDer::from(c));
|
||||
}
|
||||
rustls_pemfile::Item::X509Certificate(c) => certs.push(c),
|
||||
rustls_pemfile::Item::Pkcs8Key(k) => {
|
||||
key = Some(PrivateKeyDer::from(k));
|
||||
}
|
||||
|
||||
@@ -117,7 +117,6 @@ impl<'a> Args<'a> {
|
||||
let mut words = words.into();
|
||||
let mut long = None;
|
||||
if let Some(last) = last {
|
||||
// Optimiz
|
||||
add_impl(words.to_mut(), &mut long, last);
|
||||
}
|
||||
Args { words, long }
|
||||
@@ -262,13 +261,17 @@ impl<'a, 'de> serde::Deserialize<'de> for Args<'a> {
|
||||
use serde::de::Error;
|
||||
let mut args = Vec::<Bytes<'a>>::deserialize(de)?;
|
||||
let Some(last) = args.pop() else { return Ok(Args::empty()) };
|
||||
for (idx, arg) in args.iter().enumerate() {
|
||||
if let Some(e) = Arg::find_invalid(arg) {
|
||||
// Safety: Arg is a transparent newtype over Bytes.
|
||||
// However, even though it would be absurd for Vec to change layout
|
||||
// between two types with identical layout, Rust doesn't promise it won't happen.
|
||||
// Ergo, we're forced to copy the whole Vec out of caution.
|
||||
let mut words = Vec::with_capacity(args.len());
|
||||
for (idx, arg) in args.into_iter().enumerate() {
|
||||
if let Some(e) = Arg::find_invalid(&arg) {
|
||||
return Err(D::Error::custom(format!("invalid arg @ index {idx}: {e}")));
|
||||
}
|
||||
words.push(unsafe { Arg::from_unchecked(arg) });
|
||||
}
|
||||
// Safety: Arg is a transparent newtype over Bytes.
|
||||
let mut words = unsafe { std::mem::transmute(args) };
|
||||
let mut long = None;
|
||||
match last.try_into() {
|
||||
Ok(last) => add_impl(&mut words, &mut long, last),
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
#![doc = include_str!("../doc/rustdoc/lib.md")]
|
||||
#![deny(clippy::as_ptr_cast_mut)]
|
||||
#![allow(clippy::borrow_interior_mutable_const)]
|
||||
#![allow(clippy::mutable_key_type)]
|
||||
#![deny(clippy::missing_safety_doc)]
|
||||
#![deny(clippy::redundant_else)]
|
||||
#![deny(clippy::semicolon_if_nothing_returned)]
|
||||
#![warn(clippy::semicolon_if_nothing_returned)]
|
||||
#![warn(clippy::semicolon_inside_block)]
|
||||
#![warn(clippy::semicolon_outside_block)]
|
||||
#![deny(clippy::transmute_undefined_repr)]
|
||||
#![deny(missing_docs)]
|
||||
#![deny(rustdoc::bare_urls)]
|
||||
#![deny(rustdoc::broken_intra_doc_links)]
|
||||
@@ -11,6 +15,7 @@
|
||||
#![deny(rustdoc::invalid_html_tags)]
|
||||
#![deny(rustdoc::invalid_rust_codeblocks)]
|
||||
#![deny(rustdoc::private_intra_doc_links)]
|
||||
#![deny(unused_unsafe)]
|
||||
#![cfg_attr(doc_unstable, feature(doc_auto_cfg))]
|
||||
|
||||
#[macro_use]
|
||||
@@ -24,4 +29,5 @@ pub mod names;
|
||||
pub mod owning;
|
||||
pub mod state;
|
||||
pub mod string;
|
||||
|
||||
pub(crate) mod util;
|
||||
|
||||
Reference in New Issue
Block a user