1
0
Fork 0
forked from wry/wry

all: use expect attribute where possible

This commit is contained in:
Julian Orth 2024-09-06 11:08:22 +02:00
parent c3b50dc653
commit e377470f3f
134 changed files with 241 additions and 296 deletions

View file

@ -139,7 +139,6 @@ pub fn val(
macro_rules! ty {
($f:ident, $lt:lifetime, $ty:ident, $ret:ty, $v:ident, $map:expr, $name:expr) => {
#[allow(dead_code)]
pub fn $f(
name: &'static str,
) -> impl for<$lt> FnOnce(&mut Extractor<$lt>) -> Result<Spanned<$ret>, Spanned<ExtractorError>> {
@ -158,7 +157,7 @@ ty!(int, 'a, Integer, i64, v, *v, "an integer");
ty!(flt, 'a, Float, f64, v, *v, "a float");
ty!(bol, 'a, Boolean, bool, v, *v, "a boolean");
ty!(arr, 'a, Array, &'a [Spanned<Value>], v, &**v, "an array");
ty!(tbl, 'a, Table, &'a IndexMap<Spanned<String>, Spanned<Value>>, v, v, "a table");
// ty!(tbl, 'a, Table, &'a IndexMap<Spanned<String>, Spanned<Value>>, v, v, "a table");
pub fn fltorint(
name: &'static str,
@ -176,7 +175,6 @@ pub fn fltorint(
macro_rules! int {
($f:ident, $ty:ident, $err:ident) => {
#[allow(dead_code)]
pub fn $f(
name: &'static str,
) -> impl for<'v> FnOnce(&mut Extractor<'v>) -> Result<Spanned<$ty>, Spanned<ExtractorError>> {
@ -254,7 +252,7 @@ macro_rules! tuples {
{
type Output = ($($name::Output,)*);
#[allow(non_snake_case)]
#[expect(non_snake_case)]
fn extract(self, extractor: &mut Extractor<'v>) -> Result<Self::Output, Spanned<ExtractorError>> {
$(
let $name = self.$idx.extract(extractor);

View file

@ -45,7 +45,7 @@ impl Display for DataTypes {
2 => write!(f, "{} or {}", d[0], d[1]),
_ => {
let mut first = true;
#[allow(clippy::needless_range_loop)]
#[expect(clippy::needless_range_loop)]
for i in 0..d.len() - 1 {
if !first {
f.write_str(", ")?;

View file

@ -442,7 +442,7 @@ impl<'a, 'b> Parser<'a, 'b> {
}
}
#[allow(clippy::type_complexity)]
#[expect(clippy::type_complexity)]
fn parse_key_value(
&mut self,
) -> Result<(Key, Spanned<Value>), (Spanned<ParserError>, Option<Key>)> {