clippy
This commit is contained in:
@@ -75,8 +75,6 @@ impl RunMenu {
|
||||
window.set_monitor(monitor.as_ref());
|
||||
if let Some(monitor) = monitor {
|
||||
let geometry = monitor.geometry();
|
||||
let (_, natural_height, _, _) =
|
||||
window.child().unwrap().measure(Orientation::Vertical, -1);
|
||||
let top_margin = (geometry.height()) / 2;
|
||||
window.set_margin(Edge::Top, top_margin - 100);
|
||||
} else {
|
||||
@@ -100,14 +98,12 @@ impl RunMenu {
|
||||
}
|
||||
if e.text_length() > 0 {
|
||||
let text = e.text();
|
||||
if text.starts_with("=") {
|
||||
if let Ok(eval) = meval::eval_str(&text[1..]) {
|
||||
let label = gtk::Label::new(Some(&format!("{eval}")));
|
||||
label.add_css_class("exec-button");
|
||||
label.set_halign(Align::Start);
|
||||
label.set_hexpand(true);
|
||||
content_box.append(&label);
|
||||
}
|
||||
if let Some(eval) = text.strip_prefix("=") {
|
||||
let label = gtk::Label::new(Some(eval));
|
||||
label.add_css_class("exec-button");
|
||||
label.set_halign(Align::Start);
|
||||
label.set_hexpand(true);
|
||||
content_box.append(&label);
|
||||
} else {
|
||||
instance_clone.list_matching(e, &content_box, &mut matcher_rc.borrow_mut());
|
||||
instance_clone.window.set_default_size(500, -1);
|
||||
@@ -164,8 +160,8 @@ impl RunMenu {
|
||||
self.window.present();
|
||||
}
|
||||
|
||||
fn create_entry(&self, content_box: >k::Box, entry: &String) -> gtk::Button {
|
||||
let entry_clone = entry.clone();
|
||||
fn create_entry(&self, content_box: >k::Box, entry: &str) -> gtk::Button {
|
||||
let entry_clone = entry.to_owned();
|
||||
let button = gtk::Button::new();
|
||||
button.set_halign(Align::Fill);
|
||||
button.set_hexpand(true);
|
||||
@@ -198,14 +194,14 @@ impl RunMenu {
|
||||
content_box: >k::Box,
|
||||
matcher: &mut Matcher,
|
||||
) -> bool {
|
||||
let keys: Vec<String> = self.entries.borrow().keys().map(|i| i.clone()).collect();
|
||||
let keys: Vec<String> = self.entries.borrow().keys().cloned().collect();
|
||||
let mut first = true;
|
||||
let mut added = false;
|
||||
for (entry, _) in Pattern::parse(&entry.text(), CaseMatching::Ignore, Normalization::Smart)
|
||||
.match_list(keys, matcher)
|
||||
.iter()
|
||||
{
|
||||
let button = self.create_entry(content_box, &entry);
|
||||
let button = self.create_entry(content_box, entry);
|
||||
if first {
|
||||
button.add_css_class("suggested");
|
||||
first = false;
|
||||
|
||||
Reference in New Issue
Block a user