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

.is_some mess in language::syntax #1224

Open
SandaruKasa opened this issue Jan 14, 2025 · 0 comments
Open

.is_some mess in language::syntax #1224

SandaruKasa opened this issue Jan 14, 2025 · 0 comments

Comments

@SandaruKasa
Copy link
Contributor

// `Some(true)` in order to respect the current configuration.
#[allow(clippy::if_same_then_else)]
if self.quote.is_some() {
if self.quote_is_doc_quote && config.treat_doc_strings_as_comments == Some(true) {
self.quote.map_or(false, |q| line.starts_with(q.as_bytes()))
|| (self.quote.is_some())
} else {
false
}
} else if self

This code feels like either it can be vastly simplified or it is a typo.

         self.quote.map_or(false, |q| line.starts_with(q.as_bytes())) 
             || (self.quote.is_some()) 

is

         self.quote.is_some_and(|q| line.starts_with(q.as_bytes())) 
             || (self.quote.is_some()) 

which is just

         self.quote.is_some()

which is true because of the line 336.

So we have

     if self.quote_is_doc_quote && config.treat_doc_strings_as_comments == Some(true) { 
         true
     } else { 
         false 
     } 

which is just

     self.quote_is_doc_quote && config.treat_doc_strings_as_comments == Some(true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant