compiler: updated to rust 1.84, now we have let chains!
This commit is contained in:
parent
fcab20579a
commit
f0c871711c
@ -39,11 +39,11 @@ impl Path {
|
|||||||
|
|
||||||
/// Checks whether this path refers to the sinkhole identifier, `_`
|
/// Checks whether this path refers to the sinkhole identifier, `_`
|
||||||
pub fn is_sinkhole(&self) -> bool {
|
pub fn is_sinkhole(&self) -> bool {
|
||||||
if let [PathPart::Ident(id)] = self.parts.as_slice() {
|
if let [PathPart::Ident(id)] = self.parts.as_slice()
|
||||||
if let "_" = id.to_ref() {
|
&& let "_" = id.to_ref()
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,12 +62,12 @@ impl Fold for ConstantFolder {
|
|||||||
(Div, |a, b| a / b, Int -> Int),
|
(Div, |a, b| a / b, Int -> Int),
|
||||||
(Rem, |a, b| a % b, Int -> Int),
|
(Rem, |a, b| a % b, Int -> Int),
|
||||||
// Cursed bit-smuggled float shenanigans
|
// Cursed bit-smuggled float shenanigans
|
||||||
(Lt, |a, b| (f64::from_bits(a) < f64::from_bits(b)), Float -> Bool),
|
(Lt, |a, b| f64::from_bits(a) < f64::from_bits(b), Float -> Bool),
|
||||||
(LtEq, |a, b| (f64::from_bits(a) >= f64::from_bits(b)), Float -> Bool),
|
(LtEq, |a, b| f64::from_bits(a) >= f64::from_bits(b), Float -> Bool),
|
||||||
(Equal, |a, b| (f64::from_bits(a) == f64::from_bits(b)), Float -> Bool),
|
(Equal, |a, b| f64::from_bits(a) == f64::from_bits(b), Float -> Bool),
|
||||||
(NotEq, |a, b| (f64::from_bits(a) != f64::from_bits(b)), Float -> Bool),
|
(NotEq, |a, b| f64::from_bits(a) != f64::from_bits(b), Float -> Bool),
|
||||||
(GtEq, |a, b| (f64::from_bits(a) <= f64::from_bits(b)), Float -> Bool),
|
(GtEq, |a, b| f64::from_bits(a) <= f64::from_bits(b), Float -> Bool),
|
||||||
(Gt, |a, b| (f64::from_bits(a) > f64::from_bits(b)), Float -> Bool),
|
(Gt, |a, b| f64::from_bits(a) > f64::from_bits(b), Float -> Bool),
|
||||||
(Add, |a, b| (f64::from_bits(a) + f64::from_bits(b)).to_bits(), Float -> Float),
|
(Add, |a, b| (f64::from_bits(a) + f64::from_bits(b)).to_bits(), Float -> Float),
|
||||||
(Sub, |a, b| (f64::from_bits(a) - f64::from_bits(b)).to_bits(), Float -> Float),
|
(Sub, |a, b| (f64::from_bits(a) - f64::from_bits(b)).to_bits(), Float -> Float),
|
||||||
(Mul, |a, b| (f64::from_bits(a) * f64::from_bits(b)).to_bits(), Float -> Float),
|
(Mul, |a, b| (f64::from_bits(a) * f64::from_bits(b)).to_bits(), Float -> Float),
|
||||||
|
@ -72,7 +72,7 @@ pub mod clangifier {
|
|||||||
Self::default()
|
Self::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn indent(&mut self) -> Section {
|
pub fn indent(&mut self) -> Section<'_> {
|
||||||
Section::new(self)
|
Section::new(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ pub mod clangifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Prints a section header and increases indentation
|
/// Prints a section header and increases indentation
|
||||||
pub fn nest(&mut self, name: impl Display) -> Section {
|
pub fn nest(&mut self, name: impl Display) -> Section<'_> {
|
||||||
print!("{name}");
|
print!("{name}");
|
||||||
self.indent()
|
self.indent()
|
||||||
}
|
}
|
||||||
|
@ -78,11 +78,11 @@ pub fn run(args: Args) -> Result<(), Box<dyn Error>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if repl {
|
if repl {
|
||||||
if let Some(file) = file {
|
if let Some(file) = file
|
||||||
if let Err(e) = load_file(&mut env, file) {
|
&& let Err(e) = load_file(&mut env, file)
|
||||||
|
{
|
||||||
eprintln!("{e}")
|
eprintln!("{e}")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
let mut ctx = Context::with_env(env);
|
let mut ctx = Context::with_env(env);
|
||||||
match mode {
|
match mode {
|
||||||
Mode::Menu => menu::main_menu(&mut ctx)?,
|
Mode::Menu => menu::main_menu(&mut ctx)?,
|
||||||
@ -106,7 +106,7 @@ pub fn run(args: Args) -> Result<(), Box<dyn Error>> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn format_path_for_display(path: Option<&Path>) -> Cow<str> {
|
fn format_path_for_display(path: Option<&Path>) -> Cow<'_, str> {
|
||||||
match path {
|
match path {
|
||||||
Some(file) => file
|
Some(file) => file
|
||||||
.to_str()
|
.to_str()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user