Skip to content

Commit cfa60ae

Browse files
committed
Fix some things
1 parent b6f79d4 commit cfa60ae

File tree

6 files changed

+15
-14
lines changed

6 files changed

+15
-14
lines changed

core/src/passwords.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ mod tests {
123123

124124
symbols.append(&Symbols::LOWER_ALPHA);
125125

126-
let password =
127-
generate_password(32, &symbols).expect("Password generation should not fail.");
126+
let password = generate_password(32, &symbols);
128127
assert_eq!(password.len(), 32);
129128

130129
assert!(password.chars().into_iter().all(|c| symbols.contains(&c)));
@@ -145,8 +144,7 @@ mod tests {
145144
symbols.append(&Symbols::NUMBERS);
146145
symbols.append(&Symbols::SPECIAL);
147146

148-
let password =
149-
generate_password(64, &symbols).expect("Password generation should not fail.");
147+
let password = generate_password(64, &symbols);
150148
assert_eq!(password.len(), 64);
151149

152150
assert!(password.chars().into_iter().all(|c| symbols.contains(&c)));

gui/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! It uses the [core](pwduck_core) module internally to manage the passwords of the user.
44
#![deny(missing_docs)]
55
#![deny(missing_debug_implementations)]
6-
#![deny(unused_results)]
6+
#![cfg_attr(not(test), deny(unused_results))]
77
#![cfg_attr(not(test), forbid(unsafe_code))]
88
#![cfg_attr(coverage, feature(no_coverage))]
99
#![warn(

gui/src/pw_modal/password_generator/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ impl PasswordGeneratorState {
118118
_,
119119
VaultTabMessage::Container(VaultContainerMessage::ModifyEntry(_)),
120120
) => Target::EntryModifier,
121-
crate::Message::VaultTab(_, VaultTabMessage::Creator(_)) => todo!(),
121+
crate::Message::VaultTab(_, VaultTabMessage::Creator(_)) => {
122+
unimplemented!("Maybe add the generator to the vault creator too")
123+
}
122124
_ => Target::None,
123125
});
124126

gui/src/vault/container/list.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl ListView {
172172
} else {
173173
self.split_state.divider_position().map_or_else(
174174
|| viewport.width / 2,
175-
|position| viewport.width - u32::from(position),
175+
|position| viewport.width - u32::from(position).min(viewport.width),
176176
)
177177
},
178178
height: viewport.height,
@@ -197,6 +197,8 @@ impl ListView {
197197
)
198198
.style(theme.split())
199199
.padding(0.0)
200+
.min_size_first(100)
201+
.min_size_second(300)
200202
.into()
201203
};
202204

gui/src/vault/container/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,9 @@ impl Component for VaultContainer {
513513
type ConstructorParam = Box<Vault>;
514514

515515
fn new(vault: Self::ConstructorParam) -> Self {
516-
let root_uuid = vault.get_root_uuid().unwrap();
516+
let root_uuid = vault
517+
.get_root_uuid()
518+
.expect("There should always be a root uuid.");
517519
let list_view = ListView::new(root_uuid, &vault);
518520

519521
Self {

src/main.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,7 @@ mod desktop {
6363
use enigo::KeyboardControllable;
6464
use rfd::AsyncFileDialog;
6565

66-
use pwduck_gui::{
67-
error::{NfdError, PWDuckGuiError},
68-
Platform, Sequence,
69-
};
66+
use pwduck_gui::{error::NfdError, Platform, Sequence};
7067

7168
/// An empty placeholder struct to implement the [`Platform`](Platform) trait for.
7269
#[derive(Default)]
@@ -126,7 +123,7 @@ mod desktop {
126123
}
127124

128125
async fn auto_type(sequence: Sequence) -> Result<(), pwduck_gui::error::PWDuckGuiError> {
129-
async_std::task::sleep(std::time::Duration::from_millis(1000)).await;
126+
async_std::task::sleep(std::time::Duration::from_millis(5000)).await;
130127

131128
let mut enigo = enigo::Enigo::new();
132129
#[cfg(target_os = "linux")]
@@ -135,7 +132,7 @@ mod desktop {
135132

136133
// Check if xdotools is available
137134
drop(which::which("xdotool")
138-
.map_err(|err| PWDuckGuiError::String(format!("xdotool could not be found. Maybe it is not installed on your system? ({})", err)))?);
135+
.map_err(|err| pwduck_gui::error::PWDuckGuiError::String(format!("xdotool could not be found. Maybe it is not installed on your system? ({})", err)))?);
139136
}
140137

141138
for part in sequence.iter() {

0 commit comments

Comments
 (0)