Skip to content

Commit

Permalink
Merge pull request #162 from yarn-slinger/lints
Browse files Browse the repository at this point in the history
Fix lints
  • Loading branch information
janhohenheim authored Jan 22, 2024
2 parents ffc3761 + 60dca92 commit c642216
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 40 deletions.
1 change: 0 additions & 1 deletion crates/bevy_plugin/src/commands/command_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ macro_rules! yarn_commands {
}

use crate::commands::command_registry::wait::Wait;
pub use yarn_commands;

#[cfg(test)]
mod tests {
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_plugin/src/localization/strings_file/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ fn combine_comments(full_old_comment: &str, new_metadata: &str) -> String {
let new_metadata = (!new_metadata.is_empty()).then_some(new_metadata);
[translator_comment, new_metadata]
.into_iter()
.filter_map(|s| s)
.flatten()
.collect::<Vec<_>>()
.join(LINE_METADATA_PREFIX_SEPARATOR)
}
Expand Down
5 changes: 1 addition & 4 deletions crates/bevy_plugin/tests/utils/assertion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ macro_rules! get_reader {
&mut $asserter.execute_command_reader
};
}
pub use get_reader;

#[macro_export]
macro_rules! assert_events {
Expand All @@ -80,7 +79,7 @@ macro_rules! assert_events {
};
($asserter:ident, $app:ident contains $event:ident (n = $num:expr) $(with $pred:expr)?) => {
let events = $app.world.resource::<bevy::prelude::Events<$event>>();
let reader = $crate::prelude::get_reader!($asserter, $event);
let reader = $crate::get_reader!($asserter, $event);
let events: Vec<&$event> = reader.iter(&events).collect();
assert_eq!($num, events.len(), "Expected {} events of type {}, but found {}: {events:#?}", stringify!($num), stringify!($event), events.len());
$(
Expand All @@ -95,5 +94,3 @@ macro_rules! assert_events {
)?
};
}

pub use assert_events;
6 changes: 3 additions & 3 deletions crates/bevy_plugin/tests/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use bevy_yarn_slinger::prelude::*;
use bevy_yarn_slinger::UnderlyingYarnLine;
use std::path::{Path, PathBuf};

mod assertion;
pub mod assertion;

pub mod prelude {
pub use super::*;
pub use assertion::*;
#[allow(unused_imports)] // False positive
pub use super::{assertion::*, *};
}

pub trait AppExt {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub(crate) fn add_initial_value_registrations(
};
if let Some(ref mut program) = compilation.program {
let value = match &declaration.r#type {
Type::String => Operand::from(String::try_from(default_value).unwrap()),
Type::String => Operand::from(String::from(default_value)),
Type::Number => Operand::from(f32::try_from(default_value).unwrap()),
Type::Boolean => Operand::from(bool::try_from(default_value).unwrap()),
_ => panic!("Cannot create initial value registration for type {}. This is a bug. Please report it at https://github.com/yarn-slinger/yarn_slinger/issues/new", declaration.r#type.format()),
Expand Down
1 change: 0 additions & 1 deletion crates/compiler/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ mod add_tags_to_lines;
pub(crate) mod antlr_rust_ext;
pub(crate) mod run_compilation;
pub(crate) mod utils;
pub use add_tags_to_lines::*;

#[allow(missing_docs)]
pub type Result<T> = std::result::Result<T, CompilerError>;
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! ## Implementation Notes
//! - `IBridgeableType` is not implemented because it is not actually used anywhere.
pub use {function::*, r#type::*, r#type::*, type_util::*};
pub use {function::*, r#type::*, type_util::*};

mod any;
mod boolean;
Expand Down
3 changes: 1 addition & 2 deletions crates/core/src/yarn_fn/function_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ mod tests {
true.into(),
1.0.into(),
]))
.try_into()
.unwrap();
.into();

assert!(result1);
assert_eq!(result2, 3.0);
Expand Down
1 change: 1 addition & 0 deletions crates/yarn_slinger/tests/test_base/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub use text_provider::SharedTextProvider;
use yarn_slinger::log::{self, LevelFilter, SetLoggerError};

pub mod prelude {
#[allow(unused_imports)] // False positive
pub use crate::test_base::{extensions::*, paths::*, step::*, test_plan::*, *};
}

Expand Down
7 changes: 7 additions & 0 deletions docs/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@ language = "en"
multilingual = false
src = "src"
title = "Yarn Slinger Book"

[output.html]
git-repository-url = "https://github.com/yarn-slinger/yarn-slinger"
git-repository-icon = "fa-github"
edit-url-template = "https://github.com/yarn-slinger/yarn-slinger/edit/main/docs/src/{path}"
site-url = "/yarn-slinger/"
cname = "https://yarn-slinger.github.io"
40 changes: 20 additions & 20 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
- [Introduction](./introduction.md)
- [Yarn Files](yarn_files.md)
- [Basics](yarn_files/basics.md)
- [Running Examples](yarn_files/running_examples.md)
- [Lines](yarn_files/lines.md)
- [Variables](yarn_files/variables.md)
- [Options](yarn_files/options.md)
- [Nodes](yarn_files/nodes.md)
- [Markup](yarn_files/markup.md)
- [Functions](yarn_files/functions.md)
- [Commands](yarn_files/commands.md)
- [Bevy Plugin](bevy_plugin.md)
- [Setup](bevy_plugin/setup.md)
- [Compiling Yarn Files](bevy_plugin/compiling_yarn_files.md)
- [`DialogRunner` and a High Level Overview](bevy_plugin/dialog_runner.md)
- [Localization](bevy_plugin/localization.md)
- [Assets](bevy_plugin/assets.md)
- [Variable Storage](bevy_plugin/variable_storage.md)
- [Custom Functions](bevy_plugin/custom_functions.md)
- [Custom Commands](bevy_plugin/custom_commands.md)
- [Dialog Views](bevy_plugin/dialog_views.md)
- [Yarn Files](./yarn_files.md)
- [Basics](./yarn_files/basics.md)
- [Running Examples](./yarn_files/running_examples.md)
- [Lines](./yarn_files/lines.md)
- [Variables](./yarn_files/variables.md)
- [Options](./yarn_files/options.md)
- [Nodes](./yarn_files/nodes.md)
- [Markup](./yarn_files/markup.md)
- [Functions](./yarn_files/functions.md)
- [Commands](./yarn_files/commands.md)
- [Bevy Plugin](./bevy_plugin.md)
- [Setup](./bevy_plugin/setup.md)
- [Compiling Yarn Files](./bevy_plugin/compiling_yarn_files.md)
- [`DialogRunner` and a High Level Overview](./bevy_plugin/dialog_runner.md)
- [Localization](./bevy_plugin/localization.md)
- [Assets](./bevy_plugin/assets.md)
- [Variable Storage](./bevy_plugin/variable_storage.md)
- [Custom Functions](./bevy_plugin/custom_functions.md)
- [Custom Commands](./bevy_plugin/custom_commands.md)
- [Dialog Views](./bevy_plugin/dialog_views.md)
- [Porting Yarn Slinger](./porting_yarn_slinger.md)
2 changes: 1 addition & 1 deletion docs/src/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ Yarn Slinger is a port of the widely used dialogue tool [Yarn Spinner](https://y

Please click on the link that describes your situation the best.

- [I'm new to all of this](./working_with_yarn_slinger.md)
- [I'm new to all of this](./yarn_files.md)
- [I have used Yarn Spinner for Unity before](./bevy_plugin.md)
- [I want to port Yarn Slinger to another language than Rust or another engine than Bevy](./porting_yarn_slinger.md)
5 changes: 0 additions & 5 deletions docs/src/working_with_yarn_slinger.md

This file was deleted.

0 comments on commit c642216

Please sign in to comment.