Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): update dependencies #122

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
branches:
- main

schedule:
# run every morning at 10am Pacific Time
- cron: '0 17 * * *'

name: ci

env:
Expand All @@ -15,7 +19,7 @@ env:
RUST_BACKTRACE: 1
# Pin the nightly toolchain to prevent breakage.
# This should be occasionally updated.
RUST_NIGHTLY_TOOLCHAIN: nightly-2023-10-06
RUST_NIGHTLY_TOOLCHAIN: nightly-2024-10-07

jobs:
env:
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ fnv = { version = "1", default-features = false }
glob = "0.3"
lazy_static = "1"
pathdiff = "0.2"
pulldown-cmark = { version = "0.9", default-features = false }
pulldown-cmark = { version = "0.12", default-features = false }
rayon = "1"
regex = "1"
reqwest = { version = "0.11", features = ["blocking", "native-tls"] }
reqwest = { version = "0.12", features = ["blocking", "native-tls"] }
serde = { version = "1", features = ["derive"] }
slug = { version = "0.1" }
structopt = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.65.0
1.81.0
4 changes: 2 additions & 2 deletions src/extract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ fn extract_sections<'a>(spec: &'a Specification) -> Vec<(&'a Section<'a>, Vec<Fe
.collect()
}

fn extract_section<'a>(section: &'a Section<'a>) -> (&'a Section<'a>, Vec<Feature>) {
fn extract_section<'a>(section: &'a Section<'a>) -> (&'a Section<'a>, Vec<Feature<'a>>) {
let mut features = vec![];
let lines = &section.lines[..];

Expand Down Expand Up @@ -204,7 +204,7 @@ pub struct Feature<'a> {
quote: Vec<&'a str>,
}

impl<'a> Feature<'a> {
impl Feature<'_> {
pub fn should_add(&self) -> bool {
match self.compound_level() {
Some(level) => level == self.level,
Expand Down
2 changes: 1 addition & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl<'a> From<ParsedAnnotation<'a>> for Annotation {
}
}

impl<'a> Iterator for Parser<'a> {
impl Iterator for Parser<'_> {
type Item = Result<Annotation, Error>;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
2 changes: 1 addition & 1 deletion src/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct Pattern<'a> {
content: &'a str,
}

impl<'a> Default for Pattern<'a> {
impl Default for Pattern<'_> {
fn default() -> Self {
Self {
meta: "//=",
Expand Down
4 changes: 2 additions & 2 deletions src/report/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ enum ReportError<'a> {
MissingSection { annotation: &'a Annotation },
}

impl<'a> fmt::Display for ReportError<'a> {
impl fmt::Display for ReportError<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Self::QuoteMismatch { annotation } => write!(
Expand Down Expand Up @@ -301,7 +301,7 @@ pub struct TargetReport<'a> {
statuses: status::StatusMap,
}

impl<'a> TargetReport<'a> {
impl TargetReport<'_> {
#[allow(dead_code)]
pub fn statistics(&self) -> Statistics {
let mut stats = Statistics::default();
Expand Down
8 changes: 4 additions & 4 deletions src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub enum SourceFile<'a> {
Spec(PathBuf),
}

impl<'a> SourceFile<'a> {
impl SourceFile<'_> {
pub fn annotations(&self) -> Result<AnnotationSet, Error> {
let mut annotations = AnnotationSet::new();
match self {
Expand Down Expand Up @@ -73,7 +73,7 @@ struct Spec<'a> {
quote: &'a str,
}

impl<'a> Spec<'a> {
impl Spec<'_> {
fn into_annotation(
self,
source: PathBuf,
Expand Down Expand Up @@ -119,7 +119,7 @@ struct Exception<'a> {
reason: String,
}

impl<'a> Exception<'a> {
impl Exception<'_> {
fn into_annotation(
self,
source: PathBuf,
Expand Down Expand Up @@ -162,7 +162,7 @@ struct Todo<'a> {
tags: BTreeSet<String>,
}

impl<'a> Todo<'a> {
impl Todo<'_> {
fn into_annotation(
self,
source: PathBuf,
Expand Down
6 changes: 3 additions & 3 deletions src/sourcemap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ pub struct Str<'a> {
pub line: usize,
}

impl<'a> fmt::Display for Str<'a> {
impl fmt::Display for Str<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.value.fmt(f)
}
}

impl<'a> Str<'a> {
impl Str<'_> {
pub fn indentation(&self) -> usize {
let trimmed_line = self.trim_start();
self.len() - trimmed_line.len()
Expand Down Expand Up @@ -126,7 +126,7 @@ impl<'a> Str<'a> {
}
}

impl<'a> Deref for Str<'a> {
impl Deref for Str<'_> {
type Target = str;

fn deref(&self) -> &str {
Expand Down
6 changes: 3 additions & 3 deletions src/specification/ietf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub enum ParserState<'a> {
Section { section: Section<'a>, indent: usize },
}

impl<'a> Default for ParserState<'a> {
impl Default for ParserState<'_> {
fn default() -> Self {
Self::Init
}
Expand Down Expand Up @@ -105,7 +105,7 @@ impl<'a> Parser<'a> {
if let Some(section) = section_header(line) {
self.state = ParserState::Section {
section,
indent: core::usize::MAX,
indent: usize::MAX,
};
}
}
Expand All @@ -132,7 +132,7 @@ impl<'a> Parser<'a> {
self.on_section(section, indent);
self.state = ParserState::Section {
section: new_section,
indent: core::usize::MAX,
indent: usize::MAX,
};
} else {
// most likely the footer/header
Expand Down
27 changes: 15 additions & 12 deletions src/specification/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ enum Token<'a> {
struct Lex<'a> {
contents: &'a str,
lines: Peekable<LinesIter<'a>>,
cmark: Peekable<pulldown_cmark::OffsetIter<'a, 'a>>,
cmark: Peekable<pulldown_cmark::OffsetIter<'a>>,
next_line: Option<Str<'a>>,
next_token: Option<Token<'a>>,
}
Expand Down Expand Up @@ -69,7 +69,7 @@ impl<'a> Iterator for Lex<'a> {
type Item = Token<'a>;

fn next(&mut self) -> Option<Self::Item> {
use pulldown_cmark::{Event::*, HeadingLevel::*, Tag::*};
use pulldown_cmark::{Event::*, HeadingLevel::*, Tag, TagEnd};

let mut header_buffer = None;
let mut text_buffer: Option<(usize, Range<usize>)> = None;
Expand All @@ -92,20 +92,26 @@ impl<'a> Iterator for Lex<'a> {
}) {
match event {
// start buffering the header contents
Start(Heading(_, _, _)) => {
header_buffer = Some((line.line, line.range()));
Start(Tag::Heading { id, .. }) => {
// convert the fragment to a Str
let fragment = id.and_then(|f| line.substr(&f));
header_buffer = Some((line.line, line.range(), fragment));
}
// we're done parsing the header
End(Heading(level, fragment, _classes)) => {
End(TagEnd::Heading(level)) => {
// consume any lines captured by the header
while self
.lines
.next_if(|line| line.pos < event_range.end)
.is_some()
{}

let fragment = header_buffer
.as_ref()
.and_then(|(_, _, fragment)| *fragment);

// convert the header buffer into a Str
let line = if let Some((line_num, mut buf)) = header_buffer {
let line = if let Some((line_num, mut buf, _)) = header_buffer {
let r = line.range();
buf.start = r.start.min(buf.start);
buf.end = r.end.max(buf.end);
Expand All @@ -114,9 +120,6 @@ impl<'a> Iterator for Lex<'a> {
line
};

// convert the fragment to a Str
let fragment = fragment.and_then(|f| line.substr(f));

// convert the text buffer range to a Str
let name = if let Some((line_num, mut buf)) = text_buffer {
buf.end = line.range().end.max(buf.end);
Expand All @@ -142,12 +145,12 @@ impl<'a> Iterator for Lex<'a> {
});
}
// insert a token break before returning the line
Start(Item) => {
Start(Tag::Item) => {
self.next_line = Some(line);
return Some(Token::Break);
}
// insert a token break after returning the item line
End(Item) => {
End(TagEnd::Item) => {
self.next_token = Some(Token::Break);
}
// buffer the text if we're parsing a header
Expand Down Expand Up @@ -257,7 +260,7 @@ pub enum ParserState<'a> {
Section { section: Section<'a>, level: u8 },
}

impl<'a> Default for ParserState<'a> {
impl Default for ParserState<'_> {
fn default() -> Self {
Self::Init
}
Expand Down
25 changes: 17 additions & 8 deletions src/specification/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct Specification<'a> {
pub format: Format,
}

impl<'a> fmt::Debug for Specification<'a> {
impl fmt::Debug for Specification<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Specification")
.field("title", &self.title)
Expand Down Expand Up @@ -149,7 +149,7 @@ pub enum Line<'a> {
Break,
}

impl<'a> Line<'a> {
impl Line<'_> {
pub fn is_empty(&self) -> bool {
match self {
Self::Str(s) => s.is_empty(),
Expand All @@ -164,15 +164,15 @@ impl<'a> From<Str<'a>> for Line<'a> {
}
}

#[derive(Clone, Debug, Eq, Hash)]
#[derive(Clone, Debug, Eq)]
pub struct Section<'a> {
pub id: String,
pub title: String,
pub full_title: Str<'a>,
pub lines: Vec<Line<'a>>,
}

impl<'a> Ord for Section<'a> {
impl Ord for Section<'_> {
fn cmp(&self, other: &Self) -> Ordering {
macro_rules! cmp {
($($tt:tt)*) => {
Expand All @@ -196,19 +196,28 @@ impl<'a> Ord for Section<'a> {
}
}

impl<'a> PartialOrd for Section<'a> {
impl core::hash::Hash for Section<'_> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.id.hash(state);
self.title.hash(state);
self.full_title.hash(state);
self.lines.hash(state);
}
}

impl PartialOrd for Section<'_> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}

impl<'a> PartialEq for Section<'a> {
impl PartialEq for Section<'_> {
fn eq(&self, other: &Self) -> bool {
self.cmp(other) == Ordering::Equal
}
}

impl<'a> Section<'a> {
impl Section<'_> {
pub fn contents(&self) -> StrView {
StrView::new(&self.lines)
}
Expand Down Expand Up @@ -276,7 +285,7 @@ pub struct StrRangeIter<'a> {
end: usize,
}

impl<'a> Iterator for StrRangeIter<'a> {
impl Iterator for StrRangeIter<'_> {
type Item = (usize, Range<usize>);

fn next(&mut self) -> Option<Self::Item> {
Expand Down
Loading