Skip to content

Commit 3a9e949

Browse files
committed
Fix warnings.
1 parent 754c84d commit 3a9e949

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

macros/src/embed_python.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ impl EmbedPython {
2424
}
2525

2626
fn add_whitespace(&mut self, span: Span, loc: LineColumn) -> Result<(), TokenStream> {
27+
#[allow(clippy::comparison_chain)]
2728
if loc.line > self.loc.line {
2829
while loc.line > self.loc.line {
2930
self.python.push('\n');

macros/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fn span_for_line(input: TokenStream, line: usize) -> Option<Span> {
6060
let mut result = spans.next()?;
6161
for span in spans {
6262
result = match result.join(span) {
63-
None => return Some(Span::from(result)),
63+
None => return Some(result),
6464
Some(span) => span,
6565
}
6666
}

src/context.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ impl Context {
4545
/// If you already have the GIL, you can use [`Context::new_with_gil`] instead.
4646
///
4747
/// This function panics if it fails to create the context.
48+
#[allow(clippy::new_without_default)]
4849
pub fn new() -> Self {
4950
Self::new_with_gil(Python::acquire_gil().python())
5051
}
@@ -190,13 +191,13 @@ impl Context {
190191
/// [`Context::run`].
191192
///
192193
/// This function panics if the Python code fails.
193-
pub fn run_with_gil<'p, F: FnOnce(&PyDict)>(&self, py: Python<'p>, code: PythonBlock<F>) {
194+
pub fn run_with_gil<F: FnOnce(&PyDict)>(&self, py: Python<'_>, code: PythonBlock<F>) {
194195
(code.set_variables)(self.globals(py));
195196
match run_python_code(py, self, code.bytecode) {
196197
Ok(_) => (),
197198
Err(e) => {
198199
e.print(py);
199-
panic!("python!{...} failed to execute");
200+
panic!("{}", "python!{...} failed to execute");
200201
}
201202
}
202203
}

src/lib.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@
55
//! ```
66
//! use inline_python::python;
77
//!
8-
//! fn main() {
9-
//! let who = "world";
10-
//! let n = 5;
11-
//! python! {
12-
//! for i in range('n):
13-
//! print(i, "Hello", 'who)
14-
//! print("Goodbye")
15-
//! }
8+
//! let who = "world";
9+
//! let n = 5;
10+
//! python! {
11+
//! for i in range('n):
12+
//! print(i, "Hello", 'who)
13+
//! print("Goodbye")
1614
//! }
1715
//! ```
1816
//!

0 commit comments

Comments
 (0)