Skip to content

Commit

Permalink
ext: nits
Browse files Browse the repository at this point in the history
  • Loading branch information
rrbutani committed May 26, 2020
1 parent b276b26 commit aaefb03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
16 changes: 6 additions & 10 deletions src/ext/disposable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use core::ops::{Deref, DerefMut};
/// See the ["mirroring interfaces" section](../../xterm#mirroring-interfaces)
/// of the `xterm` module docs for more information.
#[cfg_attr(all(docs, not(doctest)), doc(cfg(feature = "ext")))]
#[allow(clippy::module_name_repetitions)]
pub trait XtermDisposable {
/// Disposes of the instance. Dual of [`Disposable::dispose`].
///
Expand Down Expand Up @@ -59,7 +60,7 @@ pub trait XtermDisposable {
Box::new(move |_s| Self::dispose(self));
let disp = Closure::wrap(disp);

let obj = object!({ dispose: disp });
let obj = object! { dispose: disp };

Closure::forget(disp);

Expand Down Expand Up @@ -162,15 +163,9 @@ impl NoOpDispose {
/// Constructs a new [`NoOpDispose`].
#[must_use]
pub fn new() -> Self {
let obj = Object::new();

let obj = Object::define_property(
&obj,
&JsValue::from_str("dispose"),
Function::new_no_args("return;").as_ref(),
);

Self { obj }
Self {
obj: object! { dispose: Function::new_no_args("return;") },
}
}
}

Expand All @@ -195,6 +190,7 @@ impl Terminal {
/// [`DisposableWrapper`].
///
/// This is otherwise identical to [`Terminal::new`].
#[must_use]
pub fn new_with_wrapper(
options: Option<TerminalOptions>,
) -> DisposableWrapper<Terminal> {
Expand Down
4 changes: 2 additions & 2 deletions src/ext/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ pub mod _obj_macro_support {
#[macro_export]
#[cfg_attr(all(docs, not(doctest)), doc(cfg(feature = "ext")))]
macro_rules! object {
({
(
$($f:ident: $v:expr),* $(,)?
}) => {{
) => {{
let obj = $crate::ext::_obj_macro_support::Object::new();

$crate::ext::object! { obj += {
Expand Down

0 comments on commit aaefb03

Please sign in to comment.