Skip to content

Commit fa0290c

Browse files
committed
Applied clippy proposals.
1 parent eff34f2 commit fa0290c

File tree

3 files changed

+19
-22
lines changed

3 files changed

+19
-22
lines changed

rust/src/android_editor.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl AsyncEditor for AndroidImpl {
5959
let instance_receiver = self.jvm.invoke_to_channel(
6060
&self.show_menu_cb,
6161
"apply",
62-
&vec![InvocationArg::from(try_pass_menu_name)]);
62+
&[InvocationArg::from(try_pass_menu_name)]);
6363
debug!("Waiting for password...");
6464
japi::handle_instance_receiver_result(instance_receiver)
6565
}
@@ -70,7 +70,7 @@ impl AsyncEditor for AndroidImpl {
7070
let instance_receiver = self.jvm.invoke_to_channel(
7171
&self.show_menu_cb,
7272
"apply",
73-
&vec![InvocationArg::from(change_pass_menu_name)]);
73+
&[InvocationArg::from(change_pass_menu_name)]);
7474
debug!("Waiting for password...");
7575
japi::handle_instance_receiver_result(instance_receiver)
7676
}
@@ -89,21 +89,21 @@ impl AsyncEditor for AndroidImpl {
8989
self.jvm.invoke_to_channel(
9090
&self.show_menu_cb,
9191
"apply",
92-
&vec![InvocationArg::from(Menu::Main.get_name())])
92+
&[InvocationArg::from(Menu::Main.get_name())])
9393
}
9494
&Menu::EntriesList(_) => {
9595
let java_entries: Vec<japi::JavaEntry> = safe.get_entries().iter()
9696
.map(|entry| japi::JavaEntry::new(entry))
9797
.collect();
98-
let filter = if safe.get_filter().len() == 0 {
98+
let filter = if safe.get_filter().is_empty() {
9999
"null".to_string()
100100
} else {
101101
safe.get_filter().clone()
102102
};
103103
self.jvm.invoke_to_channel(
104104
&self.show_entries_set_cb,
105105
"apply",
106-
&vec![
106+
&[
107107
InvocationArg::from((
108108
java_entries.as_slice(),
109109
"org.astonbitecode.rustkeylock.api.JavaEntry",
@@ -115,7 +115,7 @@ impl AsyncEditor for AndroidImpl {
115115
self.jvm.invoke_to_channel(
116116
&self.show_entry_cb,
117117
"apply",
118-
&vec![
118+
&[
119119
InvocationArg::new(&japi::JavaEntry::new(&entry), "org.astonbitecode.rustkeylock.api.JavaEntry"),
120120
InvocationArg::from(index as i32),
121121
InvocationArg::from(false),
@@ -128,7 +128,7 @@ impl AsyncEditor for AndroidImpl {
128128
self.jvm.invoke_to_channel(
129129
&self.show_entry_cb,
130130
"apply",
131-
&vec![
131+
&[
132132
InvocationArg::new(&entry, "org.astonbitecode.rustkeylock.api.JavaEntry"),
133133
InvocationArg::from(index as i32),
134134
InvocationArg::from(false),
@@ -141,19 +141,19 @@ impl AsyncEditor for AndroidImpl {
141141
self.jvm.invoke_to_channel(
142142
&self.show_entry_cb,
143143
"apply",
144-
&vec![
144+
&[
145145
InvocationArg::new(&empty_entry, "org.astonbitecode.rustkeylock.api.JavaEntry"),
146146
InvocationArg::from(-1),
147147
InvocationArg::from(true),
148148
InvocationArg::from(false)
149149
])
150150
}
151151
&Menu::EditEntry(index) => {
152-
let ref selected_entry = safe.get_entry_decrypted(index);
152+
let selected_entry = safe.get_entry_decrypted(index);
153153
self.jvm.invoke_to_channel(
154154
&self.show_entry_cb,
155155
"apply",
156-
&vec![
156+
&[
157157
InvocationArg::new(&japi::JavaEntry::new(&selected_entry), "org.astonbitecode.rustkeylock.api.JavaEntry"),
158158
InvocationArg::from(index as i32),
159159
InvocationArg::from(true),
@@ -164,13 +164,13 @@ impl AsyncEditor for AndroidImpl {
164164
self.jvm.invoke_to_channel(
165165
&self.show_menu_cb,
166166
"apply",
167-
&vec![InvocationArg::from(Menu::ExportEntries.get_name())])
167+
&[InvocationArg::from(Menu::ExportEntries.get_name())])
168168
}
169169
&Menu::ImportEntries => {
170170
self.jvm.invoke_to_channel(
171171
&self.show_menu_cb,
172172
"apply",
173-
&vec![InvocationArg::from(Menu::ImportEntries.get_name())])
173+
&[InvocationArg::from(Menu::ImportEntries.get_name())])
174174
}
175175
&Menu::ShowConfiguration => {
176176
let conf_strings = vec![
@@ -181,13 +181,13 @@ impl AsyncEditor for AndroidImpl {
181181
self.jvm.invoke_to_channel(
182182
&self.edit_configuration_cb,
183183
"apply",
184-
&vec![InvocationArg::from((conf_strings.as_slice(), &self.jvm))])
184+
&[InvocationArg::from((conf_strings.as_slice(), &self.jvm))])
185185
}
186186
&Menu::Current => {
187187
self.jvm.invoke_to_channel(
188188
&self.show_menu_cb,
189189
"apply",
190-
&vec![InvocationArg::from(Menu::Current.get_name())])
190+
&[InvocationArg::from(Menu::Current.get_name())])
191191
}
192192
other => {
193193
panic!("Menu '{:?}' cannot be used with Entries. Please, consider opening a bug \
@@ -205,7 +205,7 @@ impl AsyncEditor for AndroidImpl {
205205
let instance_receiver = self.jvm.invoke_to_channel(
206206
&self.show_menu_cb,
207207
"apply",
208-
&vec![InvocationArg::from(Menu::Exit.get_name())]);
208+
&[InvocationArg::from(Menu::Exit.get_name())]);
209209

210210
japi::handle_instance_receiver_result(instance_receiver)
211211
} else {
@@ -228,7 +228,7 @@ impl AsyncEditor for AndroidImpl {
228228
let instance_receiver = self.jvm.invoke_to_channel(
229229
&self.show_message_cb,
230230
"apply",
231-
&vec![
231+
&[
232232
InvocationArg::from((
233233
java_user_options.as_slice(),
234234
"org.astonbitecode.rustkeylock.api.JavaUserOption",

rust/src/japi.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ fn instance_to_gui_response(instance: Instance) -> UserSelection {
108108
}
109109
GuiResponse::DeleteEntry { index } => {
110110
debug!("delete_entry");
111-
let user_selection = UserSelection::DeleteEntry(index);
112-
user_selection
111+
UserSelection::DeleteEntry(index)
113112
}
114113
GuiResponse::SetConfiguration { strings } => {
115114
debug!("set_configuration with {} elements", strings.len());
@@ -146,14 +145,13 @@ fn instance_to_gui_response(instance: Instance) -> UserSelection {
146145
GuiResponse::ExportImport { path, mode, password, number } => {
147146
debug!("export_import");
148147

149-
let user_selection = if mode > 0 {
148+
if mode > 0 {
150149
debug!("Followed exporting path");
151150
UserSelection::ExportTo(path)
152151
} else {
153152
debug!("Followed importing path");
154153
UserSelection::ImportFrom(path, password, number as usize)
155-
};
156-
user_selection
154+
}
157155
}
158156
GuiResponse::Copy { data } => {
159157
debug!("copy");

rust/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
extern crate android_logger;
1818
extern crate j4rs;
1919
extern crate jni_sys;
20-
#[allow(unused_imports)]
2120
extern crate lazy_static;
2221
extern crate libc;
2322
extern crate log;

0 commit comments

Comments
 (0)