Fix Clippy

This commit is contained in:
Riccardo Mazzarini 2025-04-25 22:06:03 +02:00
parent f1e01d0fa1
commit d7334112a0
No known key found for this signature in database
GPG key ID: 38165222613796F5
8 changed files with 15 additions and 21 deletions

View file

@ -166,7 +166,7 @@ impl Buffer {
types::ObjectKind::Nil => {
return Ret::from_object(Object::nil()).map_err(Into::into)
},
other => panic!("Unexpected object kind: {:?}", other),
other => panic!("Unexpected object kind: {other:?}"),
};
unsafe {

View file

@ -123,7 +123,7 @@ impl Window {
types::ObjectKind::Nil => {
return Ret::from_object(Object::nil()).map_err(Into::into)
},
other => panic!("Unexpected object kind: {:?}", other),
other => panic!("Unexpected object kind: {other:?}"),
};
unsafe {

View file

@ -47,8 +47,7 @@ impl Error {
Self::PopError {
ty,
message: Some(format!(
"expected a {}, found a {} instead",
expected, found
"expected a {expected}, found a {found} instead",
)),
}
}
@ -62,10 +61,7 @@ impl Error {
Self::PopError {
ty: expected,
message: Some(format!(
"expected {}, got {} instead",
expected, got
)),
message: Some(format!("expected {expected}, got {got} instead",)),
}
}

View file

@ -523,7 +523,7 @@ impl BuilderAttribute {
} else if ident == "setter" {
is_setter = true;
} else {
let msg = format!("unknown attribute `{}`", ident);
let msg = format!("unknown attribute `{ident}`");
return Err(Error::new_spanned(ident, msg));
}
@ -615,9 +615,8 @@ fn is_valid_combination(attrs: &[BuilderAttribute]) -> Result<()> {
BuilderAttribute::Inline(inline) => {
if !inline.contains(INLINE_PLACEHOLDER) {
let _msg = format!(
"expected `{}` in the expression of the `inline` \
attribute",
INLINE_PLACEHOLDER,
"expected `{INLINE_PLACEHOLDER}` in the expression \
of the `inline` attribute",
);
todo!();
}

View file

@ -46,10 +46,9 @@ pub fn test(attrs: TokenStream, item: TokenStream) -> TokenStream {
None => quote! { ::core::option::Option::None },
};
let maybe_ignore_err =
should_panic.then(|| quote!(let _ = )).unwrap_or_default();
let maybe_ignore_err = should_panic.then(|| quote!(let _ = ));
let maybe_semicolon = should_panic.then(|| quote!(;)).unwrap_or_default();
let maybe_semicolon = should_panic.then(|| quote!(;));
#[cfg(feature = "test-terminator")]
let plugin_body = match &sig.inputs.first() {

View file

@ -28,7 +28,7 @@ impl core::fmt::Debug for Dictionary {
let num_elements = self.len();
for (idx, (key, value)) in self.iter().enumerate() {
write!(f, "{}: {:?}", key, value)?;
write!(f, "{key}: {value:?}")?;
if idx + 1 < num_elements {
write!(f, ", ")?;

View file

@ -105,7 +105,7 @@ impl core::fmt::Debug for Object {
ObjectKind::LuaRef => {
let luaref = unsafe { self.data.luaref };
return write!(f, "Object(LuaRef({}))", luaref);
return write!(f, "Object(LuaRef({luaref}))");
},
};
@ -778,7 +778,7 @@ impl Poppable for Object {
Err(lua::Error::pop_error(
"Object",
format!("unexpected value of type {}", typename),
format!("unexpected value of type {typename}"),
))
},

View file

@ -41,12 +41,12 @@ pub enum DeserializeError {
impl fmt::Display for DeserializeError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Custom { msg } => write!(f, "{}", msg),
Self::Custom { msg } => write!(f, "{msg}"),
Self::DuplicateField { field } => {
write!(f, "duplicate field '{}'", field)
write!(f, "duplicate field '{field}'")
},
Self::MissingField { field } => {
write!(f, "missing field '{}'", field)
write!(f, "missing field '{field}'")
},
Self::UnknownField { field, expected } => {
write!(