diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-01-15 16:53:02 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-01-15 16:53:02 +0100 |
| commit | d763f0f5a6a700352ee8926c15c8e58624f705c9 (patch) | |
| tree | d287edfdab9793a796404516c7313689e4e69964 /src/library/insert.rs | |
| parent | 0f0416054f263b80ccec1a463ce4ab20913bdf71 (diff) | |
Split state and scopes, less ref-counting 🔀
Diffstat (limited to 'src/library/insert.rs')
| -rw-r--r-- | src/library/insert.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/library/insert.rs b/src/library/insert.rs index 51cbbf52..58e8a11c 100644 --- a/src/library/insert.rs +++ b/src/library/insert.rs @@ -16,12 +16,9 @@ pub fn image(ctx: &mut EvalContext, args: &mut Args) -> Value { let height = args.get(ctx, "height"); if let Some(path) = path { - let mut env = ctx.env.borrow_mut(); - let loaded = env.resources.load(path.v, ImageResource::parse); - + let loaded = ctx.env.resources.load(path.v, ImageResource::parse); if let Some((res, img)) = loaded { let dimensions = img.buf.dimensions(); - drop(env); ctx.push(NodeImage { res, dimensions, @@ -30,7 +27,6 @@ pub fn image(ctx: &mut EvalContext, args: &mut Args) -> Value { align: ctx.state.align, }); } else { - drop(env); ctx.diag(error!(path.span, "failed to load image")); } } |
