diff --git a/README.md b/README.md index 912338f..d9b1db3 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![build](https://img.shields.io/github/actions/workflow/status/hoodie/icalendar-rs/ci.yml?branch=main)](https://github.com/hoodie/icalendar-rs/actions?query=workflow%3A"Continuous+Integration") [![Crates.io](https://img.shields.io/crates/d/icalendar)](https://crates.io/crates/icalendar) [![contributors](https://img.shields.io/github/contributors/hoodie/icalendar-rs)](https://github.com/hoodie/icalendar-rs/graphs/contributors) -![maintenance](https://img.shields.io/maintenance/yes/2023) +![maintenance](https://img.shields.io/maintenance/yes/2025) [![version](https://img.shields.io/crates/v/icalendar)](https://crates.io/crates/icalendar/) [![documentation](https://img.shields.io/badge/docs-latest-blue.svg)](https://docs.rs/icalendar/) diff --git a/src/lib.rs b/src/lib.rs index ce70749..17bcee1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -66,6 +66,7 @@ unused_import_braces, unused_qualifications, missing_debug_implementations, + clippy::indexing_slicing, clippy::dbg_macro, clippy::doc_markdown, clippy::redundant_closure_for_method_calls diff --git a/src/parser/mod.rs b/src/parser/mod.rs index e0e88a7..5fc6598 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -81,6 +81,11 @@ pub fn read_calendar(input: &str) -> Result, String> { .map_err(|e: VerboseError<&str>| format!("error: {}", convert_error(input, e.clone()))) } +#[test] +fn begin_crash() { + assert!(read_calendar("BEGIN:").is_ok()); +} + /// Parse iCalendar file content into an array of [`Component`]s /// /// This version produces nice and readable errors with line numbers thanks the the awesomeness of [`nom`]. diff --git a/src/parser/utils.rs b/src/parser/utils.rs index d66b4e8..c019fbf 100644 --- a/src/parser/utils.rs +++ b/src/parser/utils.rs @@ -16,7 +16,7 @@ use super::parsed_string::ParseString; pub fn property_key<'a, E: ParseError<&'a str> + ContextError<&'a str>>( input: &'a str, ) -> IResult<&'a str, &str, E> { - if &input[0..=2] == "END" || &input[0..=4] == "BEGIN" { + if input.get(0..=2) == Some("END") || input.get(0..=4) == Some("BEGIN") { IResult::Err(Err::Error(nom::error::make_error( input, nom::error::ErrorKind::Satisfy, diff --git a/src/properties.rs b/src/properties.rs index 1f9ef24..0400879 100644 --- a/src/properties.rs +++ b/src/properties.rs @@ -400,6 +400,7 @@ impl From for Property { //} // Fold a content line as described in RFC 5545, Section 3.1 +#[allow(clippy::indexing_slicing)] pub(crate) fn fold_line(line: &str) -> String { let limit = 75; let len = line.len();