Auto-fix clippy::collapsible_if violations (#36428)
Release Notes: - N/A
This commit is contained in:
@@ -35,14 +35,14 @@ pub fn apply_features_and_fallbacks(
|
||||
unsafe {
|
||||
let mut keys = vec![kCTFontFeatureSettingsAttribute];
|
||||
let mut values = vec![generate_feature_array(features)];
|
||||
if let Some(fallbacks) = fallbacks {
|
||||
if !fallbacks.fallback_list().is_empty() {
|
||||
keys.push(kCTFontCascadeListAttribute);
|
||||
values.push(generate_fallback_array(
|
||||
fallbacks,
|
||||
font.native_font().as_concrete_TypeRef(),
|
||||
));
|
||||
}
|
||||
if let Some(fallbacks) = fallbacks
|
||||
&& !fallbacks.fallback_list().is_empty()
|
||||
{
|
||||
keys.push(kCTFontCascadeListAttribute);
|
||||
values.push(generate_fallback_array(
|
||||
fallbacks,
|
||||
font.native_font().as_concrete_TypeRef(),
|
||||
));
|
||||
}
|
||||
let attrs = CFDictionaryCreate(
|
||||
kCFAllocatorDefault,
|
||||
|
||||
@@ -715,10 +715,10 @@ impl Platform for MacPlatform {
|
||||
let urls = panel.URLs();
|
||||
for i in 0..urls.count() {
|
||||
let url = urls.objectAtIndex(i);
|
||||
if url.isFileURL() == YES {
|
||||
if let Ok(path) = ns_url_to_path(url) {
|
||||
result.push(path)
|
||||
}
|
||||
if url.isFileURL() == YES
|
||||
&& let Ok(path) = ns_url_to_path(url)
|
||||
{
|
||||
result.push(path)
|
||||
}
|
||||
}
|
||||
Some(result)
|
||||
@@ -786,15 +786,16 @@ impl Platform for MacPlatform {
|
||||
// This is conditional on OS version because I'd like to get rid of it, so that
|
||||
// you can manually create a file called `a.sql.s`. That said it seems better
|
||||
// to break that use-case than breaking `a.sql`.
|
||||
if chunks.len() == 3 && chunks[1].starts_with(chunks[2]) {
|
||||
if Self::os_version() >= SemanticVersion::new(15, 0, 0) {
|
||||
let new_filename = OsStr::from_bytes(
|
||||
&filename.as_bytes()
|
||||
[..chunks[0].len() + 1 + chunks[1].len()],
|
||||
)
|
||||
.to_owned();
|
||||
result.set_file_name(&new_filename);
|
||||
}
|
||||
if chunks.len() == 3
|
||||
&& chunks[1].starts_with(chunks[2])
|
||||
&& Self::os_version() >= SemanticVersion::new(15, 0, 0)
|
||||
{
|
||||
let new_filename = OsStr::from_bytes(
|
||||
&filename.as_bytes()
|
||||
[..chunks[0].len() + 1 + chunks[1].len()],
|
||||
)
|
||||
.to_owned();
|
||||
result.set_file_name(&new_filename);
|
||||
}
|
||||
return result;
|
||||
})
|
||||
|
||||
@@ -1478,18 +1478,18 @@ extern "C" fn handle_key_event(this: &Object, native_event: id, key_equivalent:
|
||||
return YES;
|
||||
}
|
||||
|
||||
if key_down_event.is_held {
|
||||
if let Some(key_char) = key_down_event.keystroke.key_char.as_ref() {
|
||||
let handled = with_input_handler(this, |input_handler| {
|
||||
if !input_handler.apple_press_and_hold_enabled() {
|
||||
input_handler.replace_text_in_range(None, key_char);
|
||||
return YES;
|
||||
}
|
||||
NO
|
||||
});
|
||||
if handled == Some(YES) {
|
||||
if key_down_event.is_held
|
||||
&& let Some(key_char) = key_down_event.keystroke.key_char.as_ref()
|
||||
{
|
||||
let handled = with_input_handler(this, |input_handler| {
|
||||
if !input_handler.apple_press_and_hold_enabled() {
|
||||
input_handler.replace_text_in_range(None, key_char);
|
||||
return YES;
|
||||
}
|
||||
NO
|
||||
});
|
||||
if handled == Some(YES) {
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1624,10 +1624,10 @@ extern "C" fn handle_view_event(this: &Object, _: Sel, native_event: id) {
|
||||
modifiers: prev_modifiers,
|
||||
capslock: prev_capslock,
|
||||
})) = &lock.previous_modifiers_changed_event
|
||||
&& prev_modifiers == modifiers
|
||||
&& prev_capslock == capslock
|
||||
{
|
||||
if prev_modifiers == modifiers && prev_capslock == capslock {
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
lock.previous_modifiers_changed_event = Some(event.clone());
|
||||
@@ -1995,10 +1995,10 @@ extern "C" fn attributed_substring_for_proposed_range(
|
||||
let mut adjusted: Option<Range<usize>> = None;
|
||||
|
||||
let selected_text = input_handler.text_for_range(range.clone(), &mut adjusted)?;
|
||||
if let Some(adjusted) = adjusted {
|
||||
if adjusted != range {
|
||||
unsafe { (actual_range as *mut NSRange).write(NSRange::from(adjusted)) };
|
||||
}
|
||||
if let Some(adjusted) = adjusted
|
||||
&& adjusted != range
|
||||
{
|
||||
unsafe { (actual_range as *mut NSRange).write(NSRange::from(adjusted)) };
|
||||
}
|
||||
unsafe {
|
||||
let string: id = msg_send![class!(NSAttributedString), alloc];
|
||||
@@ -2073,11 +2073,10 @@ extern "C" fn dragging_entered(this: &Object, _: Sel, dragging_info: id) -> NSDr
|
||||
let paths = external_paths_from_event(dragging_info);
|
||||
if let Some(event) =
|
||||
paths.map(|paths| PlatformInput::FileDrop(FileDropEvent::Entered { position, paths }))
|
||||
&& send_new_event(&window_state, event)
|
||||
{
|
||||
if send_new_event(&window_state, event) {
|
||||
window_state.lock().external_files_dragged = true;
|
||||
return NSDragOperationCopy;
|
||||
}
|
||||
window_state.lock().external_files_dragged = true;
|
||||
return NSDragOperationCopy;
|
||||
}
|
||||
NSDragOperationNone
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user