<commit_before>use std::cmp::PartialEq;

use rustdoc::html::escape::Escape;

use html::ToHtml;
use html::Html;

#[deriving(Show)]
pub struct Heading {
    contents: String,
    depth: uint,
}

impl Heading {
    pub fn new(title: String, depth: uint) -> Heading {
        Heading {
            contents: title,
            depth: depth,
        }
    }
}

impl PartialEq for Heading {
    fn eq(&self, other: &Heading) -> bool {
        self.depth == other.depth && self.contents == other.contents
    }

    fn ne(&self, other: &Heading) -> bool {
        !self.eq(other)
    }
}

impl ToHtml for Heading {
    fn to_html(&self) -> Html {
        let head = format!("<h{}>{}</h{}>", self.depth, self.contents, self.depth);
        let name: String = format!("h{}", self.depth);
        Html::new_simple(name, self.contents.as_slice())
    }
}

fn pound_heading(s: &str) -> Option<Heading> {
    let mut result = None;
    if s.starts_with("#") {
        let mut count = 0u;
        let title: String = s.chars().filter_map(
            |c|
            match c {
                '#' => {
                    count += 1;
                    None
                }
                c => {
                    Some(c)
                }<commit_msg>unused variable<commit_after>use std::cmp::PartialEq;

use rustdoc::html::escape::Escape;

use html::ToHtml;
use html::Html;

#[deriving(Show)]
pub struct Heading {
    contents: String,
    depth: uint,
}

impl Heading {
    pub fn new(title: String, depth: uint) -> Heading {
        Heading {
            contents: title,
            depth: depth,
        }
    }
}

impl PartialEq for Heading {
    fn eq(&self, other: &Heading) -> bool {
        self.depth == other.depth && self.contents == other.contents
    }

    fn ne(&self, other: &Heading) -> bool {
        !self.eq(other)
    }
}

impl ToHtml for Heading {
    fn to_html(&self) -> Html {
        let name: String = format!("h{}", self.depth);
        Html::new_simple(name, self.contents.as_slice())
    }
}

fn pound_heading(s: &str) -> Option<Heading> {
    let mut result = None;
    if s.starts_with("#") {
        let mut count = 0u;
        let title: String = s.chars().filter_map(
            |c|
            match c {
                '#' => {
                    count += 1;
                    None
                }
                c => {
                    Some(c)
                }
{'fraction_non_alphanumeric': 0.14392678868552414, 'fraction_numerical': 0.0016638935108153079, 'mean_word_length': 1.687150837988827, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3669722', 'n_tokens_mistral': 774, 'n_tokens_neox': 755, 'n_words': 185}