fizyr / subst

Apache License 2.0
12 stars 5 forks source link

Compile error: there is no argument named `name` #4

Closed lizy14 closed 2 years ago

lizy14 commented 2 years ago

Hi, I want to use this crate to replace the envsubst command. I've added subst = "0.1.1" to Cargo.toml and added code to call subst::substitute. However, I can't cargo build.

error: there is no argument named `name`
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/subst-0.1.1/src/error.rs:62:35
   |
62 |                 write!(f, "No such variable: ${name}")
   |                                               ^^^^^^
   |
   = help: if you intended to capture `name` from the surrounding scope, add `#![feature(format_args_capture)]` to the crate attributes

error: could not compile `subst` due to previous error

I'm new to Rust. What should I do? Thanks!

de-vri-es commented 2 years ago

Hey, the library is using a feature from 1.58: https://blog.rust-lang.org/2022/01/13/Rust-1.58.0.html#captured-identifiers-in-format-strings

Simply updating to 1.58 or later should solve this issue :)

lizy14 commented 2 years ago

Thanks!