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

fix new clippy lints in newest version #701

Merged
merged 1 commit into from
Dec 4, 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
8 changes: 4 additions & 4 deletions crates/gosub_css3/src/tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ pub struct Token {
impl Debug for Token {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if let TokenType::Whitespace(v) = self.token_type.clone() {
return match v.as_str() {
match v.as_str() {
"\t" => write!(f, "TAB at {:?}", self.location),
"\r" => write!(f, "CR at {:?}", self.location),
"\n" => write!(f, "LF at {:?}", self.location),
_ => write!(f, "{:?} at {:?}", self.token_type, self.location),
};
}
} else {
write!(f, "{:?} at {:?}", self.token_type, self.location)
}
Expand Down Expand Up @@ -647,7 +647,7 @@ impl<'stream> Tokenizer<'stream> {
return Token::new_function(value.as_str(), loc);
}

return Token::new_ident(value.as_str(), loc);
Token::new_ident(value.as_str(), loc)
}

/// 4.3.6. [Consume a url token](https://www.w3.org/TR/css-syntax-3/#consume-a-url-token)
Expand Down Expand Up @@ -691,7 +691,7 @@ impl<'stream> Tokenizer<'stream> {
url.push(self.next_char().into());
}

return Token::new_url(url.as_str(), loc);
Token::new_url(url.as_str(), loc)
}

/// 4.3.14. [Consume the remnants of a bad url](https://www.w3.org/TR/css-syntax-3/#consume-remnants-of-bad-url)
Expand Down
4 changes: 2 additions & 2 deletions crates/gosub_html5/src/document/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ impl<D: Document<C>, C: CssSystem> DocumentQuery<D, C> {
return false;
};

return current_node_data.classlist().contains(class_name);
current_node_data.classlist().contains(class_name)
}
Condition::ContainsAttribute(attribute) => {
let Some(current_node_data) = current_node.get_element_data() else {
return false;
};

return current_node_data.attributes().contains_key(attribute);
current_node_data.attributes().contains_key(attribute)
}
Condition::ContainsChildTag(child_tag) => {
Self::contains_child_tag(doc_handle.clone(), current_node.id(), child_tag)
Expand Down
1 change: 0 additions & 1 deletion crates/gosub_html5/src/parser/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ impl ErrorLogger {
}

#[cfg(test)]

mod tests {
use super::*;

Expand Down
2 changes: 1 addition & 1 deletion crates/gosub_html5/src/parser/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub enum BookMark<NodeId> {
InsertAfter(NodeId),
}

impl<'chars, D, C> Html5Parser<'chars, D, C>
impl<D, C> Html5Parser<'_, D, C>
where
D: Document<C>,
C: CssSystem,
Expand Down
2 changes: 1 addition & 1 deletion crates/gosub_html5/src/parser/quirks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use gosub_shared::traits::css3::CssSystem;
use gosub_shared::traits::document::{Document, DocumentFragment};
use gosub_shared::traits::node::{ElementDataType, Node, QuirksMode};

impl<'chars, D, C> Html5Parser<'chars, D, C>
impl<D, C> Html5Parser<'_, D, C>
where
C: CssSystem,
D: Document<C>,
Expand Down
2 changes: 1 addition & 1 deletion crates/gosub_html5/src/tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub struct Tokenizer<'stream> {
pub error_logger: Rc<RefCell<ErrorLogger>>,
}

impl<'stream> Tokenizer<'stream> {
impl Tokenizer<'_> {
pub(crate) fn insert_tokens_at_queue_start(&mut self, first_tokens: &[Token]) {
let mut new_queue = first_tokens.to_owned();
new_queue.extend(self.token_queue.iter().cloned());
Expand Down
27 changes: 18 additions & 9 deletions crates/gosub_taffy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ impl TaffyLayouter {
pub struct LayoutDocument<'a, LT: LayoutTree<TaffyLayouter>>(&'a mut LT);

impl<LT: LayoutTree<TaffyLayouter>> TraversePartialTree for LayoutDocument<'_, LT> {
type ChildIter<'a> = IntoIter<TaffyId>
type ChildIter<'a>
= IntoIter<TaffyId>
where
Self: 'a;

Expand Down Expand Up @@ -251,10 +252,12 @@ impl<LT: LayoutTree<TaffyLayouter>> LayoutDocument<'_, LT> {
}

impl<LT: LayoutTree<TaffyLayouter>> LayoutPartialTree for LayoutDocument<'_, LT> {
type CoreContainerStyle<'a> = &'a Style
type CoreContainerStyle<'a>
= &'a Style
where
Self: 'a;
type CacheMut<'b> = &'b mut TaffyCache
type CacheMut<'b>
= &'b mut TaffyCache
where
Self: 'b;

Expand Down Expand Up @@ -305,10 +308,12 @@ impl<LT: LayoutTree<TaffyLayouter>> LayoutPartialTree for LayoutDocument<'_, LT>
}

impl<LT: LayoutTree<TaffyLayouter>> LayoutBlockContainer for LayoutDocument<'_, LT> {
type BlockContainerStyle<'a> = &'a Style
type BlockContainerStyle<'a>
= &'a Style
where
Self: 'a;
type BlockItemStyle<'a> = &'a Style
type BlockItemStyle<'a>
= &'a Style
where
Self: 'a;

Expand All @@ -322,10 +327,12 @@ impl<LT: LayoutTree<TaffyLayouter>> LayoutBlockContainer for LayoutDocument<'_,
}

impl<LT: LayoutTree<TaffyLayouter>> LayoutFlexboxContainer for LayoutDocument<'_, LT> {
type FlexboxContainerStyle<'a> = &'a Style
type FlexboxContainerStyle<'a>
= &'a Style
where
Self: 'a;
type FlexboxItemStyle<'a> = &'a Style
type FlexboxItemStyle<'a>
= &'a Style
where
Self: 'a;

Expand All @@ -339,10 +346,12 @@ impl<LT: LayoutTree<TaffyLayouter>> LayoutFlexboxContainer for LayoutDocument<'_
}

impl<LT: LayoutTree<TaffyLayouter>> LayoutGridContainer for LayoutDocument<'_, LT> {
type GridContainerStyle<'a> = &'a Style
type GridContainerStyle<'a>
= &'a Style
where
Self: 'a;
type GridItemStyle<'a> = &'a Style
type GridItemStyle<'a>
= &'a Style
where
Self: 'a;

Expand Down
3 changes: 1 addition & 2 deletions crates/gosub_useragent/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ pub struct Application<
}

impl<
'a,
D: SceneDrawer<B, L, LT, Doc, C, RT>,
B: RenderBackend,
L: Layouter,
Expand All @@ -74,7 +73,7 @@ impl<
C: CssSystem,
P: Html5Parser<C, Document = Doc>,
RT: RenderTree<C>,
> ApplicationHandler<CustomEventInternal<D, B, L, LT, Doc, C, RT>> for Application<'a, D, B, L, LT, Doc, C, P, RT>
> ApplicationHandler<CustomEventInternal<D, B, L, LT, Doc, C, RT>> for Application<'_, D, B, L, LT, Doc, C, P, RT>
{
fn resumed(&mut self, _event_loop: &ActiveEventLoop) {
info!("Resumed");
Expand Down
3 changes: 1 addition & 2 deletions crates/gosub_useragent/src/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ use gosub_shared::traits::render_tree::RenderTree;
use gosub_shared::types::Result;

impl<
'a,
D: SceneDrawer<B, L, LT, Doc, C, RT>,
B: RenderBackend,
L: Layouter,
LT: LayoutTree<L>,
Doc: Document<C>,
C: CssSystem,
RT: RenderTree<C>,
> Window<'a, D, B, L, LT, Doc, C, RT>
> Window<'_, D, B, L, LT, Doc, C, RT>
{
pub fn event<P: Html5Parser<C, Document = Doc>>(
&mut self,
Expand Down
2 changes: 1 addition & 1 deletion crates/gosub_v8/src/v8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub struct V8Context<'a> {
ctx: Rc<RefCell<V8Ctx<'a>>>,
}

impl<'a> V8Context<'a> {
impl V8Context<'_> {
pub fn error(&self, error: impl Display) {
let scope = self.scope();
let err = error.to_string();
Expand Down
2 changes: 1 addition & 1 deletion crates/gosub_webexecutor/src/js/value_conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ pub enum Ref<'a, T> {
Owned(T),
}

impl<'a, T> Ref<'a, T> {
impl<T> Ref<'_, T> {
fn get_ref(&self) -> &T {
match self {
Ref::Ref(r) => r,
Expand Down
1 change: 1 addition & 0 deletions crates/gosub_webexecutor/tests/interop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ struct Test2 {
other_field: String,
}

#[allow(clippy::ptr_arg)]
impl Test2 {
fn cool_fn(&self) -> i32 {
self.field
Expand Down
Loading