Skip to content

Commit dc17683

Browse files
PoignardAzurcmyr
authored andcommitted
Fix clippy lints for Rust 1.54
1 parent 06b37f4 commit dc17683

File tree

10 files changed

+18
-22
lines changed

10 files changed

+18
-22
lines changed

druid-shell/src/backend/mac/menu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn make_menu_item(id: u32, text: &str, key: Option<&HotKey>, enabled: bool, sele
3636
.initWithTitle_action_keyEquivalent_(
3737
make_nsstring(&stripped_text),
3838
sel!(handleMenuItem:),
39-
make_nsstring(&key_equivalent),
39+
make_nsstring(key_equivalent),
4040
)
4141
.autorelease();
4242

druid-shell/src/backend/mac/window.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ lazy_static! {
493493
);
494494

495495
let protocol = Protocol::get("NSTextInputClient").unwrap();
496-
decl.add_protocol(&protocol);
496+
decl.add_protocol(protocol);
497497

498498
ViewClass(decl.register())
499499
};

druid-shell/src/backend/windows/clipboard.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ impl Clipboard {
4949
EmptyClipboard();
5050

5151
for format in formats {
52-
let handle = make_handle(&format);
53-
let format_id = match get_format_id(&format.identifier) {
52+
let handle = make_handle(format);
53+
let format_id = match get_format_id(format.identifier) {
5454
Some(id) => id,
5555
None => {
5656
tracing::warn!(
@@ -116,10 +116,10 @@ impl Clipboard {
116116
}
117117

118118
with_clipboard(|| {
119-
let format_id = match get_format_id(&format) {
119+
let format_id = match get_format_id(format) {
120120
Some(id) => id,
121121
None => {
122-
tracing::warn!("failed to register clipboard format {}", &format);
122+
tracing::warn!("failed to register clipboard format {}", format);
123123
return None;
124124
}
125125
};
@@ -273,7 +273,7 @@ fn get_format_name(format: UINT) -> String {
273273
if result > 0 {
274274
let len = result as usize;
275275
let lpstr = std::slice::from_raw_parts(buffer.as_ptr() as *const u8, len);
276-
String::from_utf8_lossy(&lpstr).into_owned()
276+
String::from_utf8_lossy(lpstr).into_owned()
277277
} else {
278278
let err = GetLastError();
279279
if err == 87 {

druid-shell/src/backend/windows/error.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub enum Error {
3333
/// Windows error code.
3434
Hr(HRESULT),
3535
// Maybe include the full error from the direct2d crate.
36-
D2Error,
36+
Direct2D,
3737
/// A function is available on newer version of windows.
3838
OldWindows,
3939
/// The `hwnd` pointer was null.
@@ -75,7 +75,7 @@ impl fmt::Display for Error {
7575
}
7676
Ok(())
7777
}
78-
Error::D2Error => write!(f, "Direct2D error"),
78+
Error::Direct2D => write!(f, "Direct2D error"),
7979
Error::OldWindows => write!(f, "Attempted newer API on older Windows"),
8080
Error::NullHwnd => write!(f, "Window handle is Null"),
8181
}

druid-shell/src/backend/windows/menu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl Menu {
104104
let mut anno_text = text.to_string();
105105
if let Some(key) = key {
106106
anno_text.push('\t');
107-
format_hotkey(&key, &mut anno_text);
107+
format_hotkey(key, &mut anno_text);
108108
}
109109
unsafe {
110110
let mut flags = MF_STRING;

druid-shell/src/backend/x11/application.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,9 @@ impl Application {
289289
.roots
290290
.get(screen_num)
291291
.ok_or_else(|| anyhow!("Invalid screen num: {}", screen_num))?;
292-
let root_visual_type = util::get_visual_from_screen(&screen)
292+
let root_visual_type = util::get_visual_from_screen(screen)
293293
.ok_or_else(|| anyhow!("Couldn't get visual from screen"))?;
294-
let argb_visual_type = util::get_argb_visual_type(&*connection, &screen)?;
294+
let argb_visual_type = util::get_argb_visual_type(&*connection, screen)?;
295295

296296
let timestamp = Rc::new(Cell::new(x11rb::CURRENT_TIME));
297297
let pending_events = Default::default();

druid-shell/src/backend/x11/clipboard.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -419,12 +419,8 @@ impl ClipboardState {
419419
if data.len() > maximum_property_length(conn) {
420420
// We need to do an INCR transfer.
421421
debug!("Starting new INCR transfer");
422-
let transfer = IncrementalTransfer::new(
423-
conn,
424-
event,
425-
Rc::clone(&data),
426-
self.atoms.INCR,
427-
);
422+
let transfer =
423+
IncrementalTransfer::new(conn, event, Rc::clone(data), self.atoms.INCR);
428424
match transfer {
429425
Ok(transfer) => self.incremental.push(transfer),
430426
Err(err) => {

druid-shell/src/common_util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const MULTI_CLICK_MAX_DISTANCE: f64 = 5.0;
3232
/// Strip the access keys from the menu string.
3333
///
3434
/// Changes "E&xit" to "Exit". Actual ampersands are escaped as "&&".
35-
#[cfg(any(target_os = "macos", all(target_os = "linux", feature = "gtk")))]
35+
#[allow(dead_code)]
3636
pub fn strip_access_key(raw_menu_text: &str) -> String {
3737
let mut saw_ampersand = false;
3838
let mut result = String::new();

druid/examples/image.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl Rebuilder {
6262
}
6363

6464
fn rebuild_inner(&mut self, data: &AppState) {
65-
self.inner = build_widget(&data);
65+
self.inner = build_widget(data);
6666
}
6767
}
6868

@@ -79,7 +79,7 @@ impl Widget<AppState> for Rebuilder {
7979
}
8080

8181
fn update(&mut self, ctx: &mut UpdateCtx, old_data: &AppState, data: &AppState, _env: &Env) {
82-
if !old_data.same(&data) {
82+
if !old_data.same(data) {
8383
self.rebuild_inner(data);
8484
ctx.children_changed();
8585
}

druid/src/widget/list.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ where
139139
cb(&mut ret, i);
140140

141141
if !item.1.same(&ret) {
142-
self[&item.0] = ret;
142+
self[item.0] = ret;
143143
}
144144
}
145145
}

0 commit comments

Comments
 (0)