Skip to content

Commit 91a1c35

Browse files
committed
added endlines to some ast elements
1 parent cfb56bd commit 91a1c35

File tree

13 files changed

+185
-202
lines changed

13 files changed

+185
-202
lines changed

.github/workflows/msrv.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: msrv-badge
2+
3+
on:
4+
pull_request:
5+
push:
6+
workflow_dispatch:
7+
8+
jobs:
9+
create-msrv-badge:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: spenserblack/[email protected]
15+
id: get-msrv
16+
with:
17+
set: true
18+
- name: Create Badge
19+
run: curl https://img.shields.io/badge/minimum%20rust%20version-${{ steps.get-msrv.outputs.msrv }}-blue > resources/msrv.svg
20+
- name: Commit Badge
21+
# If there are no changes to the badge this would error out. But it
22+
# isn't a problem if there were no changes, so errors are allowed.
23+
continue-on-error: true
24+
run: |
25+
git add resources/msrv.svg
26+
git add Cargo.toml
27+
git config user.name "github-actions[bot]"
28+
git config user.email "github-actions[bot]@users.noreply.github.com"
29+
git commit -m "Update MSRV badge [Skip CI]"
30+
git push

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "umpl"
3-
version = "1.0.2"
3+
version = "1.1.0"
44
edition = "2021"
55
license = "MIT"
66
repository = "https://github.com/mendelsshop/umpl"
@@ -13,6 +13,6 @@ description = "Umpl is a a meme language that is a mix of c like languages and l
1313
[dependencies]
1414
unic-emoji-char = "0.9.0"
1515
hexponent = "0.3.1"
16-
log4rs = "1.1.1"
16+
simple_file_logger = "0.3.1"
1717
log = "0.4.17"
1818
lazy_static = "1.4.0"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
# [![cargo clippy](https://github.com/mendelsshop/UMPL/actions/workflows/cargo_clippy.yml/badge.svg)](https://github.com/mendelsshop/UMPL/actions/workflows/cargo_clippy.yml) [![crates.io](https://img.shields.io/crates/v/umpl.svg?label=latest%20version)](https://crates.io/crates/umpl) [![Crates.io](https://img.shields.io/crates/d/umpl?label=crates.io%20downloads)](https://crates.io/crates/umpl)
2+
# [![cargo clippy](https://github.com/mendelsshop/UMPL/actions/workflows/cargo_clippy.yml/badge.svg)](https://github.com/mendelsshop/UMPL/actions/workflows/cargo_clippy.yml) [![crates.io](https://img.shields.io/crates/v/umpl.svg?label=latest%20version)](https://crates.io/crates/umpl) [![Crates.io](https://img.shields.io/crates/d/umpl?label=crates.io%20downloads)](https://crates.io/crates/umpl) ![msrv](./resources/msrv.svg) [![](https://tokei.rs/b1/github/mendelsshop/UMPL?category=lines)](https://github.com/mendelsshop/UMPL) [![license](https://img.shields.io/github/license/mendelsshop/UMPL)](https://github.com/mendelsshop/UMPL/blob/main/LICENSE)
33

44
# UMPL
55

log.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.

resources/msrv.svg

Lines changed: 1 addition & 0 deletions
Loading

src/cli.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::process::exit;
33
use crate::error;
44
pub static mut EASY_MODE: bool = false;
55
pub static mut TOGGLE_CASE: i32 = 0;
6-
#[derive(PartialEq, Debug)]
6+
#[derive(PartialEq, Eq, Debug)]
77
pub struct ParsedArgs {
88
pub repl: bool, // inerative mode
99
pub file: String, // file to read/write
@@ -23,24 +23,24 @@ impl ParsedArgs {
2323
}
2424

2525
pub fn get_string_args(args: &[String]) -> (usize, ParsedArgs) {
26-
let mut to_return: ParsedArgs = ParsedArgs::new(false, String::from(""));
26+
let mut to_return: ParsedArgs = ParsedArgs::new(false, String::new());
2727
let mut index: usize = 1; // start at 1 because index 0 is the program name
2828
if args.len() < 2 {
2929
// if there are no arguments run in repl mode with no file
30-
return (0, ParsedArgs::new(true, String::from("")));
30+
return (0, ParsedArgs::new(true, String::new()));
3131
} else if args[1].ends_with(".umpl") {
3232
// make sure it's a .umpl file
3333
to_return.file = args[1].to_string(); // if it is, then set file to the file name
3434
to_return.repl = false; // and set repl to false
3535
index += 1; // and increment index
3636
let file_len = to_return.file.strip_suffix(".umpl").unwrap().len(); // get the length of the file name without the .umpl
37-
if args.len() > 2 && args[2] == format!("{}", file_len) {
37+
if args.len() > 2 && args[2] == format!("{file_len}") {
3838
unsafe {
3939
EASY_MODE = true;
4040
}
4141
index += 1; // and increment index
4242
} else if args.len() > 2 && args[2] == "show_length" {
43-
println!("{}", file_len); // print the length of the file name without the .umpl
43+
println!("{file_len}"); // print the length of the file name without the .umpl
4444
exit(1);
4545
}
4646
} else {
@@ -80,13 +80,10 @@ pub fn get_dash_args(args: &[String], start_index: usize, args_struct: &mut Pars
8080
};
8181
unsafe { TOGGLE_CASE = num as i32 };
8282
} else if char_part_arg == 't' {
83-
let number: i32 = match arg.split_once('=') {
84-
Some(n) => match n.1.parse() {
85-
Ok(value) => value,
86-
Err(error) => error::error(0, error),
87-
},
88-
_ => error::error(0, "option t requires an =number"),
89-
};
83+
let number: i32 = arg.split_once('=').map_or_else(|| error::error(0, "option t requires an =number"), |n| match n.1.parse() {
84+
Ok(value) => value,
85+
Err(error) => error::error(0, error),
86+
});
9087
unsafe {
9188
TOGGLE_CASE = number;
9289
}

src/error.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub fn error<T: Display>(line: i32, message: T) -> ! {
1414
if message.is_empty() {
1515
message = "Segmentation fault (core dumped)";
1616
}
17-
eprintln!("[line: {}], Error{}: {}", line, where_, message);
17+
eprintln!("[line: {line}], Error{where_}: {message}");
1818
exit(1);
1919
}
2020

@@ -30,13 +30,13 @@ pub fn arg_error<T: Display>(
3030
if num_args < given_args {
3131
error(
3232
line,
33-
format!("{} requires at least {} arguments", function, num_args),
33+
format!("{function} requires at least {num_args} arguments"),
3434
);
3535
}
3636
} else if num_args != given_args {
3737
error(
3838
line,
39-
format!("{} requires {} arguments", function, num_args),
39+
format!("{function} requires {num_args} arguments"),
4040
);
4141
}
4242
}

0 commit comments

Comments
 (0)