Format Rust sources at 100 columns
This commit is contained in:
1 parent
4661f595f8
commit
610478f8c7
336 files changed
+23497
-7892
No files matched your search
@@ -33,8 +33,9 @@ impl ModalMaterial {
|
||||
return Err("Dialog materials require Wayland".into());
|
||||
};
|
||||
// Iced lends live native handles; this backend borrows its connection.
|
||||
let backend =
|
||||
unsafe { wayland_client::backend::Backend::from_foreign_display(display.display.as_ptr().cast()) };
|
||||
let backend = unsafe {
|
||||
wayland_client::backend::Backend::from_foreign_display(display.display.as_ptr().cast())
|
||||
};
|
||||
let connection = Connection::from_backend(backend);
|
||||
let id = unsafe {
|
||||
wayland_client::backend::ObjectId::from_ptr(
|
||||
@@ -43,7 +44,8 @@ impl ModalMaterial {
|
||||
)
|
||||
}
|
||||
.map_err(|error| error.to_string())?;
|
||||
let surface = wl_surface::WlSurface::from_id(&connection, id).map_err(|error| error.to_string())?;
|
||||
let surface =
|
||||
wl_surface::WlSurface::from_id(&connection, id).map_err(|error| error.to_string())?;
|
||||
let (globals, mut queue) =
|
||||
registry_queue_init::<MaterialState>(&connection).map_err(|error| error.to_string())?;
|
||||
let qh = queue.handle();
|
||||
@@ -57,7 +59,9 @@ impl ModalMaterial {
|
||||
material,
|
||||
};
|
||||
let mut state = MaterialState::default();
|
||||
queue.roundtrip(&mut state).map_err(|error| error.to_string())?;
|
||||
queue
|
||||
.roundtrip(&mut state)
|
||||
.map_err(|error| error.to_string())?;
|
||||
if !state.ready {
|
||||
return Err("Dialog material attachment was not acknowledged".into());
|
||||
}
|
||||
@@ -116,8 +120,8 @@ delegate_noop!(MaterialState: ignore FereseMaterialManagerV1);
|
||||
mod tests {
|
||||
use super::*;
|
||||
use cosmic::iced::window::raw_window_handle::{
|
||||
DisplayHandle, HandleError, HasDisplayHandle, HasWindowHandle, WaylandDisplayHandle, WaylandWindowHandle,
|
||||
WindowHandle,
|
||||
DisplayHandle, HandleError, HasDisplayHandle, HasWindowHandle, WaylandDisplayHandle,
|
||||
WaylandWindowHandle, WindowHandle,
|
||||
};
|
||||
use std::ptr::NonNull;
|
||||
use wayland_client::protocol::wl_compositor;
|
||||
@@ -166,7 +170,8 @@ mod tests {
|
||||
queue.roundtrip(&mut MaterialState::default()).unwrap();
|
||||
// The compositor rejects duplicate materials. Reattachment proves the final
|
||||
// drop destroyed the first material while preserving the borrowed display.
|
||||
let replacement = ModalMaterial::attach(&window).expect("last clone released the surface material");
|
||||
let replacement =
|
||||
ModalMaterial::attach(&window).expect("last clone released the surface material");
|
||||
drop(replacement);
|
||||
queue.roundtrip(&mut MaterialState::default()).unwrap();
|
||||
window.surface.destroy();
|
||||
|
||||
@@ -110,7 +110,9 @@ mod tests {
|
||||
let server = std::thread::spawn(move || {
|
||||
for revision in [1, 2] {
|
||||
let (mut connection, _) = listener.accept().unwrap();
|
||||
connection.set_read_timeout(Some(Duration::from_secs(5))).unwrap();
|
||||
connection
|
||||
.set_read_timeout(Some(Duration::from_secs(5)))
|
||||
.unwrap();
|
||||
let get: Request = read_frame(&mut connection).unwrap();
|
||||
assert_eq!(get.command, "theme-get");
|
||||
let mut snapshot = fallback();
|
||||
@@ -145,9 +147,11 @@ mod tests {
|
||||
.unwrap();
|
||||
assert_eq!(snapshot.revision, revision);
|
||||
}
|
||||
tokio::task::spawn_blocking(move || watch_receive.recv_timeout(Duration::from_secs(5)).unwrap())
|
||||
.await
|
||||
.unwrap();
|
||||
tokio::task::spawn_blocking(move || {
|
||||
watch_receive.recv_timeout(Duration::from_secs(5)).unwrap()
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
drop(subscription);
|
||||
});
|
||||
server.join().unwrap();
|
||||
|
||||
@@ -37,7 +37,8 @@ fn explicit_solid_style_round_trips_without_resolving_published_values() {
|
||||
value[key]["tokens"]["focus_ring"]["style"] = json!("solid");
|
||||
}
|
||||
|
||||
let snapshot = Snapshot::decode(value.clone(), || panic!("unexpected catalog resolution")).unwrap();
|
||||
let snapshot =
|
||||
Snapshot::decode(value.clone(), || panic!("unexpected catalog resolution")).unwrap();
|
||||
assert_eq!(serde_json::to_value(snapshot).unwrap(), value);
|
||||
}
|
||||
|
||||
@@ -46,7 +47,8 @@ fn older_snapshots_supply_catalog_but_explicit_empty_catalog_stays_empty() {
|
||||
let mut value = fixture();
|
||||
value.as_object_mut().unwrap().remove("families");
|
||||
value.as_object_mut().unwrap().remove("fallback_note");
|
||||
let snapshot: Snapshot = Snapshot::decode(value.clone(), ferese_config::families::builtins).unwrap();
|
||||
let snapshot: Snapshot =
|
||||
Snapshot::decode(value.clone(), ferese_config::families::builtins).unwrap();
|
||||
assert_eq!(snapshot.families, ferese_config::families::builtins());
|
||||
assert_eq!(snapshot.fallback_note, None);
|
||||
value["families"] = json!([]);
|
||||
@@ -63,7 +65,8 @@ fn older_snapshots_supply_catalog_but_explicit_empty_catalog_stays_empty() {
|
||||
#[test]
|
||||
fn offline_preview_resolves_without_changing_published_values() {
|
||||
let before = fallback();
|
||||
let document = ferese_config::Document::parse("theme { mode \"light\"; family \"gruvbox\"; }\n").unwrap();
|
||||
let document =
|
||||
ferese_config::Document::parse("theme { mode \"light\"; family \"gruvbox\"; }\n").unwrap();
|
||||
let candidate = ferese_config::theme::resolve(
|
||||
&document,
|
||||
std::path::Path::new("/unused"),
|
||||
@@ -71,7 +74,10 @@ fn offline_preview_resolves_without_changing_published_values() {
|
||||
|_| panic!("built-in preview must not read theme files"),
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(candidate.theme.appearance, ferese_config::theme::Appearance::Light);
|
||||
assert_eq!(
|
||||
candidate.theme.appearance,
|
||||
ferese_config::theme::Appearance::Light
|
||||
);
|
||||
assert_eq!(candidate.theme.tokens.colors.surface_base, "#FBF1C7");
|
||||
assert_eq!(before, fallback());
|
||||
}
|
||||
@@ -79,7 +85,8 @@ fn offline_preview_resolves_without_changing_published_values() {
|
||||
#[test]
|
||||
fn complete_snapshots_do_not_resolve_fallbacks_and_future_versions_are_rejected() {
|
||||
let value = fixture();
|
||||
let snapshot = Snapshot::decode(value.clone(), || panic!("unexpected catalog resolution")).unwrap();
|
||||
let snapshot =
|
||||
Snapshot::decode(value.clone(), || panic!("unexpected catalog resolution")).unwrap();
|
||||
assert_eq!(serde_json::to_value(snapshot).unwrap(), value);
|
||||
let mut future = value;
|
||||
future["version"] = json!(ferese_ipc::theme::SCHEMA_VERSION + 1);
|
||||
|
||||
Reference in new issue
Block a user