1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-02-21 20:38:44 +00:00

build_assets.rs: Sort first to make dependencies.dedup() actually useful

This commit is contained in:
Martin Nordholts 2021-09-22 09:22:43 +02:00
parent 44a332c1c4
commit 122cae7902

View File

@ -20,8 +20,8 @@ type SyntaxToDependencies = HashMap<SyntaxName, Vec<OtherSyntax>>;
type SyntaxToDependents<'a> = HashMap<SyntaxName, Vec<OtherSyntax>>; type SyntaxToDependents<'a> = HashMap<SyntaxName, Vec<OtherSyntax>>;
/// Represents some other `*.sublime-syntax` file, i.e. another [SyntaxDefinition]. /// Represents some other `*.sublime-syntax` file, i.e. another [SyntaxDefinition].
#[derive(Debug, Eq, PartialEq, Clone, Hash)] #[derive(Debug, Eq, PartialEq, PartialOrd, Ord, Clone, Hash)]
enum OtherSyntax { pub(crate) enum OtherSyntax {
/// By name. Example YAML: `include: C.sublime-syntax` (name is `"C"`) /// By name. Example YAML: `include: C.sublime-syntax` (name is `"C"`)
ByName(String), ByName(String),
@ -304,6 +304,7 @@ fn dependencies_for_syntax(syntax: &SyntaxDefinition) -> Vec<OtherSyntax> {
.collect(); .collect();
// No need to track a dependency more than once // No need to track a dependency more than once
dependencies.sort();
dependencies.dedup(); dependencies.dedup();
dependencies dependencies