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

style: Replace unnecessary map_or #1221

Merged
merged 1 commit into from
Jan 8, 2025
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
2 changes: 1 addition & 1 deletion prost-build/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl Comments {
let mut chars = sanitized_line.chars();
chars
.next()
.map_or(false, |c| c != ' ' || chars.next() == Some(' '))
.is_some_and(|c| c != ' ' || chars.next() == Some(' '))
}

/// Sanitizes the line for rustdoc by performing the following operations:
Expand Down
7 changes: 2 additions & 5 deletions prost-build/src/code_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ impl CodeGenerator<'_> {
// If no package is specified the start of the package name will be '.'
// and split will return an empty string ("") which breaks resolution
// The fix to this is to ignore the first item if it is empty.
if local_path.peek().map_or(false, |s| s.is_empty()) {
if local_path.peek().is_some_and(|s| s.is_empty()) {
local_path.next();
}

Expand Down Expand Up @@ -1103,10 +1103,7 @@ impl CodeGenerator<'_> {

/// Returns `true` if the field options includes the `deprecated` option.
fn deprecated(&self, field: &FieldDescriptorProto) -> bool {
field
.options
.as_ref()
.map_or(false, FieldOptions::deprecated)
field.options.as_ref().is_some_and(FieldOptions::deprecated)
}

/// Returns the fully-qualified name, starting with a dot
Expand Down
Loading