Skip to content

Commit 83b27fa

Browse files
committed
Update to edition 2024
1 parent 6805012 commit 83b27fa

File tree

30 files changed

+47
-56
lines changed

30 files changed

+47
-56
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ members = ["omniwsa-ls"]
55
name = "omniwsa"
66
version = "0.1.0"
77
authors = ["Thalia Archibald <[email protected]>"]
8-
edition = "2021"
8+
edition = "2024"
99
description = "An assembler for all dialects of Whitespace assembly"
1010
repository = "https://github.com/thaliaarchi/omniwsa"
1111
license = "MPL-2.0"

omniwsa-ls/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "omniwsa-ls"
33
version = "0.1.0"
44
authors = ["Thalia Archibald <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
description = "A language server for all dialects of Whitespace assembly"
77
repository = "https://github.com/thaliaarchi/omniwsa"
88
license = "MPL-2.0"

omniwsa-ls/src/main.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ use std::{
88
use bstr::ByteSlice;
99
use lsp_server::{Connection, Message, Request, Response};
1010
use lsp_types::{
11-
request::{Request as _, SemanticTokensFullRequest},
1211
InitializeParams, SemanticToken, SemanticTokenModifier, SemanticTokenType, SemanticTokens,
1312
SemanticTokensFullOptions, SemanticTokensLegend, SemanticTokensOptions, SemanticTokensParams,
1413
SemanticTokensResult, SemanticTokensServerCapabilities, ServerCapabilities,
14+
request::{Request as _, SemanticTokensFullRequest},
1515
};
1616
use omniwsa::{
1717
dialects::{Dialect, Palaiologos},
1818
tokens::{
19+
GroupError, Token,
1920
comment::BlockCommentError,
2021
string::{CharError, StringError},
21-
GroupError, Token,
2222
},
2323
};
2424
use serde_json::{from_value as from_json, to_value as to_json};
@@ -193,7 +193,7 @@ fn main_loop(
193193
return Err(Box::new(io::Error::new(
194194
ErrorKind::Unsupported,
195195
format!("unknown method {method}"),
196-
)))
196+
)));
197197
}
198198
}
199199
}

src/codegen/wsa.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ use crate::{
99
codegen::{Inst, IntegerBits, LabelBits, TokenWrite},
1010
syntax::{Cst, Inst as WsaInst, Opcode, Overload},
1111
tokens::{
12+
Token, WordToken,
1213
integer::Integer,
1314
string::{Encoding, StringToken},
14-
Token, WordToken,
1515
},
1616
};
1717

src/dialects/burghard/dialect.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
33
use crate::{
44
dialects::{
5+
Dialect,
56
burghard::{lex::Lexer, option::OptionNester, parse::Parser},
67
define_mnemonics,
78
dialect::DialectState,
8-
Dialect,
99
},
1010
lex::Lex,
1111
syntax::Cst,
12-
tokens::{integer::IntegerSyntax, Token},
12+
tokens::{Token, integer::IntegerSyntax},
1313
};
1414

1515
// TODO:
@@ -93,13 +93,13 @@ mod tests {
9393
dialects::{Burghard, Dialect as _},
9494
syntax::{ArgLayout, Cst, Dialect, Inst, InstError, Opcode, OptionBlock},
9595
tokens::{
96+
GroupError, GroupStyle, GroupToken, SplicedToken, Token, WordToken,
9697
comment::{BlockCommentStyle, BlockCommentToken},
9798
integer::{BaseStyle, Integer, IntegerToken, Sign},
9899
mnemonics::MnemonicToken,
99100
spaces::{EofToken, LineTermStyle, LineTermToken, SpaceToken, Spaces},
100101
string::{Encoding, QuoteStyle, StringToken},
101102
words::Words,
102-
GroupError, GroupStyle, GroupToken, SplicedToken, Token, WordToken,
103103
},
104104
};
105105

src/dialects/burghard/lex.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ use enumset::EnumSet;
55
use crate::{
66
lex::{Lex, Scanner},
77
tokens::{
8+
GroupError, GroupStyle, GroupToken, Token, WordError, WordToken,
89
comment::{
910
BlockCommentError, BlockCommentStyle, BlockCommentToken, LineCommentError,
1011
LineCommentStyle, LineCommentToken,
1112
},
1213
spaces::{EofToken, LineTermStyle, LineTermToken, SpaceToken, Spaces},
13-
GroupError, GroupStyle, GroupToken, Token, WordError, WordToken,
1414
},
1515
};
1616

src/dialects/burghard/parse.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ use std::{borrow::Cow, mem};
55
use enumset::EnumSet;
66

77
use crate::{
8-
dialects::{burghard::lex::Lexer, dialect::DialectState, Burghard},
8+
dialects::{Burghard, burghard::lex::Lexer, dialect::DialectState},
99
lex::TokenStream,
1010
syntax::{ArgLayout, ArgType, HasError, Inst, InstError, Opcode},
1111
tokens::{
12+
GroupError, GroupStyle, SplicedToken, Token, VariableStyle, VariableToken,
1213
label::{LabelStyle, LabelToken},
1314
mnemonics::MnemonicToken,
1415
spaces::Spaces,
1516
string::{Encoding, QuoteStyle, StringError, StringToken},
1617
words::Words,
17-
GroupError, GroupStyle, SplicedToken, Token, VariableStyle, VariableToken,
1818
},
1919
};
2020

src/dialects/censoredusername/dialect.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
//! Parsing for the CensoredUsername Whitespace assembly dialect.
22
33
use crate::{
4-
dialects::{censoredusername::lex::Lexer, define_mnemonics, dialect::DialectState, Dialect},
4+
dialects::{Dialect, censoredusername::lex::Lexer, define_mnemonics, dialect::DialectState},
55
lex::Lex,
66
syntax::Cst,
77
tokens::{
8-
integer::{BaseStyle, DigitSep, IntegerSyntax, SignStyle},
98
Token,
9+
integer::{BaseStyle, DigitSep, IntegerSyntax, SignStyle},
1010
},
1111
};
1212

src/dialects/censoredusername/lex.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
use enumset::EnumSet;
44

55
use crate::{
6-
dialects::{dialect::DialectState, CensoredUsername},
6+
dialects::{CensoredUsername, dialect::DialectState},
77
lex::{Lex, Scanner},
88
tokens::{
9+
ErrorToken, Token, WordToken,
910
comment::{LineCommentError, LineCommentStyle, LineCommentToken},
1011
label::LabelColonToken,
1112
spaces::{ArgSepStyle, ArgSepToken, EofToken, LineTermStyle, LineTermToken, SpaceToken},
12-
ErrorToken, Token, WordToken,
1313
},
1414
};
1515

src/dialects/dialect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use std::marker::PhantomData;
55
use crate::{
66
syntax::{Cst, Opcode},
77
tokens::{
8+
Token,
89
integer::IntegerSyntax,
910
mnemonics::{FoldedStr, MnemonicMap},
10-
Token,
1111
},
1212
};
1313

src/dialects/palaiologos/dialect.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22
33
use crate::{
44
dialects::{
5-
define_mnemonics,
5+
Dialect, define_mnemonics,
66
dialect::DialectState,
77
palaiologos::{lex::Lexer, parse::Parser},
8-
Dialect,
98
},
109
lex::Lex,
1110
syntax::Cst,
1211
tokens::{
13-
integer::{BaseStyle, DigitSep, Integer, IntegerSyntax, SignStyle},
1412
Token,
13+
integer::{BaseStyle, DigitSep, Integer, IntegerSyntax, SignStyle},
1514
},
1615
};
1716

src/dialects/palaiologos/lex.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
use enumset::EnumSet;
44

55
use crate::{
6-
dialects::{dialect::DialectState, palaiologos::dialect::MAX_MNEMONIC_LEN, Palaiologos},
6+
dialects::{Palaiologos, dialect::DialectState, palaiologos::dialect::MAX_MNEMONIC_LEN},
77
lex::{Lex, Scanner},
88
syntax::Opcode,
99
tokens::{
10+
ErrorToken, Token,
1011
comment::{LineCommentStyle, LineCommentToken},
1112
label::{LabelError, LabelStyle, LabelToken},
1213
mnemonics::MnemonicToken,
@@ -15,7 +16,6 @@ use crate::{
1516
LineTermToken, SpaceToken,
1617
},
1718
string::Encoding,
18-
ErrorToken, Token,
1919
},
2020
};
2121

src/dialects/palaiologos/parse.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ use std::collections::HashSet;
55
use enumset::EnumSet;
66

77
use crate::{
8-
dialects::{dialect::DialectState, palaiologos::lex::Lexer, Palaiologos},
8+
dialects::{Palaiologos, dialect::DialectState, palaiologos::lex::Lexer},
99
lex::TokenStream,
1010
syntax::{ArgLayout, Cst, Dialect, Inst, Opcode},
1111
tokens::{
12+
Token,
1213
label::{LabelError, LabelStyle, LabelToken},
1314
spaces::{ArgSepError, InstSepError, Spaces},
1415
words::Words,
15-
Token,
1616
},
1717
};
1818

src/dialects/voliva/dialect.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
//! Parsing for the voliva Whitespace assembly dialect.
22
33
use crate::{
4-
dialects::{define_mnemonics, dialect::DialectState, voliva::lex::Lexer, Dialect},
4+
dialects::{Dialect, define_mnemonics, dialect::DialectState, voliva::lex::Lexer},
55
lex::Lex,
66
syntax::Cst,
77
tokens::{
8-
integer::{BaseStyle, DigitSep, IntegerSyntax, SignStyle},
98
Token,
9+
integer::{BaseStyle, DigitSep, IntegerSyntax, SignStyle},
1010
},
1111
};
1212

src/dialects/voliva/lex.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
use enumset::EnumSet;
44

55
use crate::{
6-
dialects::{dialect::DialectState, Voliva},
6+
dialects::{Voliva, dialect::DialectState},
77
lex::{Lex, Scanner},
88
tokens::{
9+
Token, WordError, WordToken,
910
comment::{LineCommentError, LineCommentStyle, LineCommentToken},
1011
integer::{BaseStyle, Sign},
1112
spaces::{EofToken, LineTermStyle, LineTermToken, SpaceToken},
1213
string::Encoding,
13-
Token, WordError, WordToken,
1414
},
1515
};
1616

src/dialects/wconrad/dialect.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
//! Parsing for the wconrad Whitespace assembly dialect.
22
33
use crate::{
4-
dialects::{define_mnemonics, wconrad::lex::Lexer, Dialect, DialectState},
4+
dialects::{Dialect, DialectState, define_mnemonics, wconrad::lex::Lexer},
55
lex::Lex,
66
syntax::Cst,
77
tokens::{
8-
integer::{BaseStyle, DigitSep, IntegerSyntax, SignStyle},
98
Token,
9+
integer::{BaseStyle, DigitSep, IntegerSyntax, SignStyle},
1010
},
1111
};
1212

src/dialects/wconrad/lex.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use crate::{
44
lex::{Lex, Scanner},
5-
tokens::{spaces::EofToken, Token},
5+
tokens::{Token, spaces::EofToken},
66
};
77

88
/// A lexer for tokens in the wconrad Whitespace assembly dialect.

src/dialects/wsf/dialect.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
//! Parsing for the wsf Whitespace assembly dialect.
22
33
use crate::{
4-
dialects::{define_mnemonics, dialect::DialectState, wsf::lex::Lexer, Dialect},
4+
dialects::{Dialect, define_mnemonics, dialect::DialectState, wsf::lex::Lexer},
55
lex::Lex,
66
syntax::Cst,
77
tokens::{
8-
integer::{BaseStyle, DigitSep, IntegerSyntax, SignStyle},
98
Token,
9+
integer::{BaseStyle, DigitSep, IntegerSyntax, SignStyle},
1010
},
1111
};
1212

src/dialects/wsf/lex.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
use enumset::EnumSet;
44

55
use crate::{
6-
dialects::{dialect::DialectState, Wsf},
6+
dialects::{Wsf, dialect::DialectState},
77
lex::{Lex, Scanner},
88
tokens::{
9+
ErrorToken, Token, WordToken,
910
comment::{LineCommentError, LineCommentStyle, LineCommentToken},
1011
label::LabelColonToken,
1112
spaces::{EofToken, LineTermStyle, LineTermToken, SpaceToken},
1213
string::Encoding,
13-
ErrorToken, Token, WordToken,
1414
},
1515
};
1616

src/syntax/inst.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use enumset::{EnumSet, EnumSetType};
44

55
use crate::{
66
syntax::{HasError, Opcode, Overload},
7-
tokens::{spaces::Spaces, words::Words, Token},
7+
tokens::{Token, spaces::Spaces, words::Words},
88
};
99

1010
// TODO:

src/syntax/pretty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::borrow::Cow;
44

55
use crate::{
66
syntax::{Cst, Inst, OptionBlock},
7-
tokens::{spaces::Spaces, words::Words, Token},
7+
tokens::{Token, spaces::Spaces, words::Words},
88
};
99

1010
/// Pretty-prints this node as Whitespace assembly syntax.

src/tokens/integer/convert.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ fn most_significant_byte(int: &Integer) -> u8 {
167167
// Avoid dependency on `gmp_mpfr_sys::gmp::limb_t`.
168168
#[inline]
169169
unsafe fn as_bytes<T>(s: &[T]) -> &[u8] {
170-
slice::from_raw_parts(s.as_ptr() as *const u8, mem::size_of_val(s))
170+
unsafe { slice::from_raw_parts(s.as_ptr() as *const u8, mem::size_of_val(s)) }
171171
}
172172
// SAFETY: The pointer and length are valid and the alignment of u8 is less
173173
// than u64.
@@ -178,9 +178,5 @@ fn most_significant_byte(int: &Integer) -> u8 {
178178
/// Gets the most-significant hex digit from the integer.
179179
fn most_significant_hex_digit(int: &Integer) -> u8 {
180180
let msb = most_significant_byte(int);
181-
if msb > 0x0f {
182-
msb >> 4
183-
} else {
184-
msb
185-
}
181+
if msb > 0x0f { msb >> 4 } else { msb }
186182
}

src/tokens/integer/haskell.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
//! ([docs](https://hackage.haskell.org/package/base-4.19.0.0/docs/GHC-Err.html#v:errorWithoutStackTrace))
5555
5656
use bstr::ByteSlice;
57-
use enumset::{enum_set, EnumSet};
57+
use enumset::{EnumSet, enum_set};
5858

5959
use crate::tokens::integer::{BaseStyle, DigitSep, IntegerError, IntegerSyntax, Sign, SignStyle};
6060

src/tokens/integer/integer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::borrow::Cow;
44

55
use bstr::ByteSlice;
66
use derive_more::Debug as DebugCustom;
7-
use enumset::{enum_set, EnumSet, EnumSetType};
7+
use enumset::{EnumSet, EnumSetType, enum_set};
88

99
use crate::{
1010
syntax::{HasError, Pretty},

src/tokens/spaces/categories.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use std::fmt::{self, Debug, Formatter};
44

5-
use enumset::{enum_set, EnumSet, EnumSetType};
5+
use enumset::{EnumSet, EnumSetType, enum_set};
66

77
use crate::{lex::Scanner, tokens::spaces::SpaceToken};
88

src/tokens/string/parse.rs

-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ impl<'s> CharScan<'s> {
172172
}
173173
let data = match ch {
174174
Some(mut ch) => {
175-
// TODO: Use if-let chain once stabilized.
176175
if escaped {
177176
if let Some(unescaped) = unescape(ch) {
178177
ch = unescaped;

src/tokens/token.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,8 @@ impl<'s> Token<'s> {
180180
let mut tok = self;
181181
loop {
182182
match tok {
183-
Token::Group(GroupToken { ref mut inner, .. })
184-
| Token::Spliced(SplicedToken {
185-
spliced: ref mut inner,
186-
..
187-
}) => {
183+
Token::Group(GroupToken { inner, .. })
184+
| Token::Spliced(SplicedToken { spliced: inner, .. }) => {
188185
tok = inner;
189186
}
190187
_ => return tok,

0 commit comments

Comments
 (0)