@@ -173,7 +173,7 @@ macro_rules! static_commands {
173impl MappableCommand {
173impl MappableCommand {
174 pub fn execute(&self, cx: &mut Context) {
174 pub fn execute(&self, cx: &mut Context) {
175 match &self {
175 match &self {
176− MappableCommand::Typable { name, args, doc: _ } => {
176+ Self::Typable { name, args, doc: _ } => {
177 let args: Vec<Cow<str>> = args.iter().map(Cow::from).collect();
177 let args: Vec<Cow<str>> = args.iter().map(Cow::from).collect();
178 if let Some(command) = cmd::TYPABLE_COMMAND_MAP.get(name.as_str()) {
178 if let Some(command) = cmd::TYPABLE_COMMAND_MAP.get(name.as_str()) {
179 let mut cx = compositor::Context {
179 let mut cx = compositor::Context {
@@ -186,21 +186,21 @@ impl MappableCommand {
189− MappableCommand::Static { fun, .. } => (fun)(cx),
189+ Self::Static { fun, .. } => (fun)(cx),
193 pub fn name(&self) -> &str {
193 pub fn name(&self) -> &str {
194 match &self {
194 match &self {
195− MappableCommand::Typable { name, .. } => name,
195+ Self::Typable { name, .. } => name,
196− MappableCommand::Static { name, .. } => name,
196+ Self::Static { name, .. } => name,
200 pub fn doc(&self) -> &str {
200 pub fn doc(&self) -> &str {
201 match &self {
201 match &self {
202− MappableCommand::Typable { doc, .. } => doc,
202+ Self::Typable { doc, .. } => doc,
203− MappableCommand::Static { doc, .. } => doc,
203+ Self::Static { doc, .. } => doc,
@@ -3494,11 +3494,9 @@ pub fn apply_document_resource_op(op: &lsp::ResourceOp) -> std::io::Result<()> {
3494 match op {
3494 match op {
3495 ResourceOp::Create(op) => {
3495 ResourceOp::Create(op) => {
3496 let path = op.uri.to_file_path().unwrap();
3496 let path = op.uri.to_file_path().unwrap();
3497− let ignore_if_exists = if let Some(options) = &op.options {
3497+ let ignore_if_exists = op.options.as_ref().map_or(false, |options| {
3498 !options.overwrite.unwrap_or(false) && options.ignore_if_exists.unwrap_or(false)
3498 !options.overwrite.unwrap_or(false) && options.ignore_if_exists.unwrap_or(false)
3502 if ignore_if_exists && path.exists() {
3500 if ignore_if_exists && path.exists() {
3504 } else {
3502 } else {
@@ -3508,11 +3506,12 @@ pub fn apply_document_resource_op(op: &lsp::ResourceOp) -> std::io::Result<()> {
3508 ResourceOp::Delete(op) => {
3506 ResourceOp::Delete(op) => {
3509 let path = op.uri.to_file_path().unwrap();
3507 let path = op.uri.to_file_path().unwrap();
3510 if path.is_dir() {
3508 if path.is_dir() {
3511− let recursive = if let Some(options) = &op.options {
3509+ let recursive = op
3512+ .and_then(|options| options.recursive)
3512− options.recursive.unwrap_or(false)
3513+ .unwrap_or(false);
3516 if recursive {
3515 if recursive {
3517 fs::remove_dir_all(&path)
3516 fs::remove_dir_all(&path)
3518 } else {
3517 } else {
@@ -3527,11 +3526,9 @@ pub fn apply_document_resource_op(op: &lsp::ResourceOp) -> std::io::Result<()> {
3527 ResourceOp::Rename(op) => {
3526 ResourceOp::Rename(op) => {
3528 let from = op.old_uri.to_file_path().unwrap();
3527 let from = op.old_uri.to_file_path().unwrap();
3529 let to = op.new_uri.to_file_path().unwrap();
3528 let to = op.new_uri.to_file_path().unwrap();
3530− let ignore_if_exists = if let Some(options) = &op.options {
3529+ let ignore_if_exists = op.options.as_ref().map_or(false, |options| {
3531 !options.overwrite.unwrap_or(false) && options.ignore_if_exists.unwrap_or(false)
3530 !options.overwrite.unwrap_or(false) && options.ignore_if_exists.unwrap_or(false)
3535 if ignore_if_exists && to.exists() {
3532 if ignore_if_exists && to.exists() {
3537 } else {
3534 } else {