Fix feature builds.
This commit is contained in:
parent
62462ffead
commit
f6553c1426
@ -327,10 +327,7 @@ fn optimize_stmt(stmt: &mut Stmt, state: &mut State, preserve_result: bool) {
|
||||
|
||||
*stmt = if preserve_result {
|
||||
// -> { expr, Noop }
|
||||
let mut statements = Vec::new();
|
||||
statements.push(Stmt::Expr(expr));
|
||||
statements.push(mem::take(&mut x.0));
|
||||
Stmt::Block(statements, pos)
|
||||
Stmt::Block(vec![Stmt::Expr(expr), mem::take(&mut x.0)], pos)
|
||||
} else {
|
||||
// -> expr
|
||||
Stmt::Expr(expr)
|
||||
@ -415,8 +412,7 @@ fn optimize_stmt(stmt: &mut Stmt, state: &mut State, preserve_result: bool) {
|
||||
Stmt::Break(pos) => {
|
||||
// Only a single break statement - turn into running the guard expression once
|
||||
state.set_dirty();
|
||||
let mut statements = Vec::new();
|
||||
statements.push(Stmt::Expr(mem::take(condition)));
|
||||
let mut statements = vec![Stmt::Expr(mem::take(condition))];
|
||||
if preserve_result {
|
||||
statements.push(Stmt::Noop(pos))
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Implementations of [`serde::Serialize`].
|
||||
|
||||
use crate::dynamic::Union;
|
||||
use crate::dynamic::{Union, Variant};
|
||||
use crate::stdlib::string::ToString;
|
||||
use crate::{Dynamic, ImmutableString};
|
||||
use serde::ser::{Serialize, SerializeMap, Serializer};
|
||||
@ -34,7 +34,7 @@ impl Serialize for Dynamic {
|
||||
}
|
||||
Union::FnPtr(f, _) => ser.serialize_str(f.fn_name()),
|
||||
#[cfg(not(feature = "no_std"))]
|
||||
Union::TimeStamp(x, _) => ser.serialize_str((**x).type_name()),
|
||||
Union::TimeStamp(x, _) => ser.serialize_str(x.as_ref().type_name()),
|
||||
|
||||
Union::Variant(v, _) => ser.serialize_str((***v).type_name()),
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user