Skip to content

Commit 80d8831

Browse files
committed
Updgrade to edition 2024
1 parent 90fd39c commit 80d8831

File tree

12 files changed

+21
-20
lines changed

12 files changed

+21
-20
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ members = ["cli"]
44
[package]
55
name = "libcorn"
66
version = "0.10.0"
7-
edition = "2021"
7+
edition = "2024"
88
license = "MIT"
99
description = "Parsing engine for Corn, a simple and pain-free configuration language."
1010
repository = "https://github.com/JakeStanger/corn"

benches/serde.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use criterion::{criterion_group, criterion_main, Criterion};
1+
use criterion::{Criterion, criterion_group, criterion_main};
22
use paste::paste;
33
use serde::Deserialize;
44
use std::hint::black_box;

cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "corn-cli"
33
version = "0.10.0"
4-
edition = "2021"
4+
edition = "2024"
55
license = "MIT"
66
description = "CLI for Corn. A simple and pain-free configuration language."
77
repository = "https://github.com/corn-config/corn"

cli/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use corn::{parse, BorrowedValue};
1+
use corn::{BorrowedValue, parse};
22
use std::io::Read;
33
use std::process::exit;
44
use std::{fs, io};
@@ -7,7 +7,7 @@ use clap::{Parser, ValueEnum};
77
use colored::Colorize;
88

99
mod error;
10-
use error::{print_err, Error, ExitCode};
10+
use error::{Error, ExitCode, print_err};
1111

1212
#[derive(ValueEnum, Clone, Copy, Debug)]
1313
enum OutputType {

src/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::{lexer::StringPart, Integer};
1+
use crate::{Integer, lexer::StringPart};
22
use alloc::vec::Vec;
33

44
#[cfg(not(feature = "std"))]

src/de.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ use alloc::{
77
use serde::de::{self, IntoDeserializer};
88

99
use crate::{
10+
BorrowedObject, BorrowedValue, Error, IndexMap, Result,
1011
ast::{Entry, EntryOrSpread, Inputs, PairOrSpread, Root},
1112
lexer::{Lexer, StringPart},
1213
parser::RootParser,
13-
BorrowedObject, BorrowedValue, Error, IndexMap, Result,
1414
};
1515

1616
/// A structure that deserializes Corn configuration values.
@@ -247,10 +247,10 @@ impl<'de> Deserializer<'de> {
247247
inputs: &Inputs<'input>,
248248
) -> Result<BorrowedValue<'input>> {
249249
#[cfg(feature = "std")]
250-
if let Some(env) = input.strip_prefix("env_") {
251-
if let Ok(env) = std::env::var(env) {
252-
return Ok(BorrowedValue::String(Cow::Owned(env)));
253-
}
250+
if let Some(env) = input.strip_prefix("env_")
251+
&& let Ok(env) = std::env::var(env)
252+
{
253+
return Ok(BorrowedValue::String(Cow::Owned(env)));
254254
}
255255

256256
if let Some(entry) = inputs.get(input) {

src/lexer.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,11 @@ fn parse_literal<'input>(
215215
let slice = string_lex.slice();
216216
let hex_part = &slice[3..slice.len() - 1];
217217

218-
if let Ok(code) = u32::from_str_radix(hex_part, 16) {
219-
if let Some(unicode_char) = char::from_u32(code) {
220-
current_literal.push(unicode_char);
221-
continue;
222-
}
218+
if let Ok(code) = u32::from_str_radix(hex_part, 16)
219+
&& let Some(unicode_char) = char::from_u32(code)
220+
{
221+
current_literal.push(unicode_char);
222+
continue;
223223
}
224224

225225
current_literal.push('\u{FFFD}');

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ pub mod ast;
2727
pub mod lexer;
2828
lalrpop_util::lalrpop_mod!(pub parser, "/corn.rs");
2929

30-
pub use de::{from_str, parse, Deserializer};
30+
pub use de::{Deserializer, from_str, parse};
3131
pub use error::{Error, Result};
3232
pub use value::{BorrowedObject, BorrowedValue, Integer, Object, Value};

src/value/de.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use alloc::{string::String, vec::Vec};
2-
use serde::{de::Visitor, Deserialize};
2+
use serde::{Deserialize, de::Visitor};
33

44
use crate::{Object, Value};
55

src/value/integer.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
use core::fmt::{Debug, Display};
22

33
use serde::{
4+
Deserialize, Serialize,
45
de::{self, Visitor},
5-
forward_to_deserialize_any, Deserialize, Serialize,
6+
forward_to_deserialize_any,
67
};
78

89
use crate::Error;

0 commit comments

Comments
 (0)