如何解决sqlx安装由于类型不匹配而失败
我正在Ubuntu 18.04上安装sqlx:
cargo install --git https://github.com/launchbadge/sqlx sqlx-cli
我得到了错误
error[E0308]: mismatched types
--> sqlx-cli/src/opt.rs:8:20
|
8 | #[clap(short = "D",long)]
| ^^^ expected `char`,found `&str`
$ rustc --explain E0308
Expected type did not match the received type.
Erroneous code example:
```
let x: i32 = "I am not a number!";
// ~~~ ~~~~~~~~~~~~~~~~~~~~
// | |
// | initializing expression;
// | compiler infers type `&str`
// |
// type `i32` assigned to variable `x`
```
This error occurs when the compiler is unable to infer the concrete type of a
variable. It can occur in several cases,the most common being a mismatch
between two types: the type the author explicitly assigned,and the type the
compiler inferred.
$ rustc --version
rustc 1.47.0 (18bf6b4f0 2020-10-07)
$ cargo --version
cargo 1.47.0 (f3c7e066a 2020-08-28)
解决方法
运行
import fileinput
string1 = "text substring text substring text substring text" #this string is in the text file "file_containing_string1"
list1 = [element1,element2,element3]
...
with fileinput.FileInput(file_containing_string1,inplace = True,backup = ".bak") as file:
for element in list1:
for line in file:
line = line.replace("substring",element,1)
print(line,end = "")
代替
cargo install -f --git https://github.com/launchbadge/sqlx sqlx-cli
解决了问题
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。