fix a panic
This commit is contained in:
parent
4125d61dfe
commit
8dcd0ed9c2
5 changed files with 16 additions and 2 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
use nix
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,2 +1,3 @@
|
|||
/target
|
||||
/Cargo.lock
|
||||
.direnv/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "readformat"
|
||||
version = "1.0.1"
|
||||
version = "1.0.2"
|
||||
edition = "2021"
|
||||
repository = "https://github.com/tudbut/readformat"
|
||||
license = "MIT"
|
||||
|
|
|
|||
12
shell.nix
Normal file
12
shell.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{ pkgs ? import <nixpkgs> {} }:
|
||||
pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
rust-analyzer
|
||||
cargo
|
||||
rustc
|
||||
clippy
|
||||
rustfmt
|
||||
cargo-watch
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ pub fn readf(format: &str, mut s: &str) -> Option<Vec<String>> {
|
|||
}
|
||||
{
|
||||
let pat = patterns[0];
|
||||
if &s[..pat.len()] != pat {
|
||||
if !s.get(..pat.len()).is_some_and(|x| x == pat) {
|
||||
return None;
|
||||
}
|
||||
if DEBUG {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue